Skip to content

Commit 2fedb2b

Browse files
committed
Revert "fix: use blocking GLib main context iteration to prevent CPU busy-spin"
This reverts commit 1112bba. See: rhinstaller/kickstart-tests#1710 (comment)
1 parent e61c233 commit 2fedb2b

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎simpleline/event_loop/glib_event_loop.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@
4343

4444
class GLibEventLoop(AbstractEventLoop):
4545

46-
def __init__(self, blocking=True):
46+
def __init__(self):
4747
super().__init__()
48-
self._blocking = blocking
4948
# Create first loop
5049
loop = GLib.MainLoop()
5150
self._event_loops = [EventLoopData(loop)]
@@ -209,9 +208,12 @@ def process_signals(self, return_after=None):
209208
else:
210209
self._iterate_event_loop(loop_data.loop)
211210

212-
def _iterate_event_loop(self, event_loop):
211+
@staticmethod
212+
def _iterate_event_loop(event_loop):
213213
context = event_loop.get_context()
214-
context.iteration(self._blocking)
214+
# This is useful for tests
215+
wait_on_timeout = False
216+
context.iteration(wait_on_timeout)
215217

216218

217219
class EventLoopData():

‎tests/units/glib/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _quit_loop(self, loop):
4242
def create_glib_loop(self):
4343
# clear flags
4444
self.timeout_error = False
45-
self.loop = GLibEventLoop(blocking=False)
45+
self.loop = GLibEventLoop()
4646

4747
loop = self.loop.active_main_loop
4848
context = loop.get_context()

0 commit comments

Comments
 (0)