Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid race condition in event_reactor test (#572)
These tests essentially queue an event, wait for the event reactor to process the event, and check that an appropriate function was or was not called. The way we were previously waiting for the event reactor thread to do the work left a window between popping the work from the queue and actually passing the event to the observers. If the flush loop finished early in this window, there was a chance that the test's assert would beat the event reactor, which hadn't yet invoked the observers. Rather than change the behavior of the flush function to also ensure that the popped work had completed processing, we can simply use the queue's integrated work tracking, which won't unblock until there is no work in the queue OR processing.
- Loading branch information