| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
| |
Avoid blocking for IO if there are any timeout or idle callback events
available to process. This will prevent starvation of the idle
callbacks, which are much more common since commit
a3100be184ba1cac2f672f0a1cadcf01690c6d3f. We don't want these idle
callbacks to be delayed by long periods of IO blocking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
This may be useful for using threads to handle blocking IO with Jython,
since Jython lacks the fcntl module which is needed for non-blocking IO
(see http://bugs.jython.org/issue1074).
|
| |
|
|
|
|
|
|
| |
This fixes a case where EventLoop could consume 100% CPU while waiting
for a child process. It also fixes timeout calculations in python 2.x,
where it was using integer division instead of float.
|
| |
|
|
|
|
| |
This will fix bug #432024.
|
|
|
|
|
|
|
| |
For API consumers, this makes the doebuild() function compatible with
threads, avoiding a ValueError raised by the signal module, as reported
at http://bugs.sabayon.org/show_bug.cgi?id=3305. Classes derived from
PollScheduler still use the signal module when possible.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Run timeouts last, in order to minimize latency in termination of
iteration loops that they may control.
|
| |
|
|
|
|
|
| |
The effect is be mostly the same, but it's more conistent to use
_do_poll for all blocking, plus it has EINTR handling.
|
|
|
|
|
|
|
|
|
| |
The IO watch is dynamically registered and unregistered as needed,
since we don't want to consider it as a valid source of events when
there are no child listeners. It's important to distinguish when there
are no valid sources of IO events, in order to avoid an endless poll
call if there's no timeout. This fixes possbible endless poll calls
since commit 1979a6cdfcd8c6bae4565982d82d862be07ba5be.
|
|
|
|
|
|
| |
TODO: Find out why SIGCHLD signals aren't delivered during poll calls,
forcing us to wakeup in order to receive them. This fixes random hangs
in poll calls since commit 1979a6cdfcd8c6bae4565982d82d862be07ba5be.
|
| |
|
|
|
|
|
| |
This fixes an infinite loop since commit
1979a6cdfcd8c6bae4565982d82d862be07ba5be.
|
| |
|
|
|
|
|
|
|
| |
Sleep so that we don't waste cpu time by looping too quickly. This
makes EventLoop useful for code that needs to wait for timeout
callbacks regardless of whether or not any IO handlers are currently
registered.
|
| |
|
|
|
|
|
|
| |
IO event handlers may be re-entrant, in case something like
AbstractPollTask._wait_loop(), needs to be called inside a handler for
some reason.
|
|
|
|
|
|
|
| |
Silently handle EINTR, which is normal when we have received a signal
such as SIGINT. Also, raise StopIteration in order to break out of our
current iteration and respond appropriately to the signal as soon as
possible.
|
|
|
|
|
|
|
| |
This fixes infinite loops triggered by Ctrl-C, where timeout calls
would exhaust the poll event queue because _poll was not re-entrant.
Now, re-entrance is only prohibited for individual callback functions,
in order to protect against infinite recursion.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This fixes EventLoop.iteration() so that it doesn't poll too long when
there are timeouts registered, since it's not nice to spend a long time
polling for an IO event that might never arrive even though a timeout
may have changed some state that would terminate a timeout loop like
in QueueScheduler.run() or AbstractPollTask._wait_loop(). This makes
EventLoop.iteration() behave more like GlibEventLoop.iteration().
|
| |
|
|
|
|
|
|
| |
It's conceivable the constants could be implementation dependent, so
use glib's generic IO_* names rather than the POLL* names which are
associated specifically with python's select.poll object.
|
| |
|
|
|
|
|
|
| |
This causes all PollScheduler instances within a given process to share
a singleton EventLoop instance, and also makes it possible to swap in
glib's main loop for all portage event loops in the main process.
|
|
|
|
| |
This caused emerge to consume 100% cpu.
|
|
|