bitbake: server/process: Fix waitEvent() calls with 0 timeout

You might think Queue.Queue.get(True, 0) would return an event immediately
if present and otherwise return. It doesn't, it immediately "times out"
and returns with nothing from the queue.

The behaviour we want is not to wait but return anything present which is
what .get(False) does so map to this.

This fixes some odd behaviour observed in some of the tinfoil selftests.

(Bitbake rev: 412bfab8721ea317898a1974f6a7a0d0bea763df)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2017-07-07 14:38:54 +01:00
parent fe40092afb
commit 9245c3b87f

View File

@@ -253,6 +253,8 @@ class ProcessEventQueue(multiprocessing.queues.Queue):
try:
if not self.server.is_alive():
return self.getEvent()
if timeout == 0:
return self.get(False)
return self.get(True, timeout)
except Empty:
return None