Skip to content

Commit

Permalink
Add Queue.get() non-blocking handler in main event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemekWirkus committed Feb 26, 2016
1 parent 9fd88c3 commit 9375c5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mbed_host_tests/host_tests_runner/host_test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ def callback__notify_prn(key, value, timestamp):
while (time() - start_time) < timeout_duration:
# Handle default events like timeout, host_test_name, ...
if event_queue.qsize():

This comment has been minimized.

Copy link
@mazimkhan

mazimkhan Feb 29, 2016

Contributor

Are we in tight loop until event_queue.qsize() returns >0.
This if check can be removed as below we are trying to fetch every 1 sec until timeout.

(key, value, timestamp) = event_queue.get()
try:
(key, value, timestamp) = event_queue.get(timeout=1)
except QueueEmpty as e:
continue

if consume_preamble_events:
if key == '__timeout':
Expand Down

0 comments on commit 9375c5a

Please sign in to comment.