Skip to content

Commit

Permalink
test/glib_util: fix SignalWait.wait()
Browse files Browse the repository at this point in the history
All callers expect it to pop queued emissions - i. e. repeated wait()
calls shouldn't result in a busy loop.
  • Loading branch information
amezin committed Oct 20, 2022
1 parent 3ff04fb commit bbdced4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/glib_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ def wait(self):
while not self.emissions and self.handler_id is not None:
self.loop.run()

return self.emissions.popleft() if self.emissions else None

def __iter__(self):
return self

def __next__(self):
self.wait()
result = self.wait()

if not self.emissions:
if result is None:
raise StopIteration()

return self.emissions.popleft()
return result

0 comments on commit bbdced4

Please sign in to comment.