diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-12-27 17:35:49 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-12-27 17:44:27 -0800 |
commit | a0f22daa7cf359aac776a45bbc60d22dcd947034 (patch) | |
tree | 21344bff13b0e407c730d2ef34f996c7ef1d5881 /DEVELOPING | |
parent | 684e0f9fa1ed5039dc51e7854bd9cb318a2eaafe (diff) | |
download | portage-a0f22daa7cf359aac776a45bbc60d22dcd947034.tar.gz portage-a0f22daa7cf359aac776a45bbc60d22dcd947034.tar.bz2 portage-a0f22daa7cf359aac776a45bbc60d22dcd947034.zip |
EventLoop.iteration(): avoid busy waiting
In order to avoid blocking forever when may_block is True (the
default), callers must be careful to ensure that at least one of the
following conditions is met:
1) An event source or timeout is registered which is guaranteed
to trigger at least on event (a call to an idle function
only counts as an event if it returns a False value which
causes it to be stop being called)
2) Another thread is guaranteed to call one of the thread-safe
methods which notify iteration to stop waiting (such as
idle_add or timeout_add).
These rules ensure that iteration is able to block until an event
arrives, without doing any busy waiting that would waste CPU time.
This will fix busy waiting which would be triggered by
PopenPipeBlockingIOTestCase when waiting for the thread from
PipeReaderBlockingIO to call idle_add.
Diffstat (limited to 'DEVELOPING')
0 files changed, 0 insertions, 0 deletions