summaryrefslogtreecommitdiffstats
path: root/pym/portage/util/_eventloop
Commit message (Collapse)AuthorAgeFilesLines
* Enable FD_CLOEXEC for non-blocking pipes.Zac Medico2013-01-031-2/+11
|
* EventLoop: enable FD_CLOEXEC on epoll fdZac Medico2013-01-031-0/+11
|
* EventLoop.iteration: no IO blocking if possibleZac Medico2012-12-301-4/+18
| | | | | | | | 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.
* EventLoop.iteration(): avoid busy waitingZac Medico2012-12-271-14/+40
| | | | | | | | | | | | | | | | | | | 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.
* Add PipeReaderBlockingIO, Jython experimentation.Zac Medico2012-12-271-3/+13
|
* EventLoop: thread-safe idle_add and timeout_addZac Medico2012-12-261-68/+97
| | | | | | 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).
* EventLoop: handle Linux 2.4 errno 38 for epollZac Medico2012-11-221-8/+19
|
* EventLoop: fix busy loop waiting for child pidZac Medico2012-09-252-14/+18
| | | | | | 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.
* EventLoop: handle EINTR IOError for epollZac Medico2012-08-221-2/+4
|
* EventLoop: use epoll when availableZac Medico2012-08-211-7/+52
| | | | This will fix bug #432024.
* PollScheduler: use local EventLoop (thread safe)Zac Medico2012-05-101-18/+32
| | | | | | | 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.
* Replace @returns with @return.Zac Medico2012-03-271-1/+1
|
* _eventloop: use explicit relative importsv2.2.0_alpha87Zac Medico2012-02-173-7/+6
|
* PollSelectAdapter: don't inherit PollConstantsZac Medico2012-02-171-1/+1
|
* Move Poll{Constants,SelectAdapter} to _eventloop.Zac Medico2012-02-173-3/+94
|
* Move _emerge.SlotObject to portage.util.Zac Medico2012-02-171-1/+1
|
* EventLoop: fix _io_handler_class "f" attributeZac Medico2012-02-171-1/+1
|
* EventLoop.iteration: run timeouts lastZac Medico2012-02-171-12/+12
| | | | | Run timeouts last, in order to minimize latency in termination of iteration loops that they may control.
* EventLoop: prune obsolete codeZac Medico2012-02-171-70/+18
|
* EventLoop.iteration: poll for blocking, not sleepZac Medico2012-02-161-2/+5
| | | | | The effect is be mostly the same, but it's more conistent to use _do_poll for all blocking, plus it has EINTR handling.
* EventLoop.child_watch_add: dynamic IO watchZac Medico2012-02-161-10/+22
| | | | | | | | | 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.
* EventLoop: wakeup poll loop to receive sigchildZac Medico2012-02-161-1/+12
| | | | | | 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.
* EventLoop: fix signal race in _sigchld_initZac Medico2012-02-161-1/+1
|
* EventLoop: fix _sigchld_io_cb to return TrueZac Medico2012-02-161-0/+1
| | | | | This fixes an infinite loop since commit 1979a6cdfcd8c6bae4565982d82d862be07ba5be.
* EventLoop: implement child_watch_addZac Medico2012-02-162-0/+96
|
* EventLoop.iteration: sleep if no IO handlersZac Medico2012-02-151-1/+13
| | | | | | | 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.
* EventLoop.timeout_add: fix inverted min intervalZac Medico2012-02-151-1/+1
|
* EventLoop: allow IO event handler re-entranceZac Medico2012-02-141-11/+6
| | | | | | IO event handlers may be re-entrant, in case something like AbstractPollTask._wait_loop(), needs to be called inside a handler for some reason.
* EventLoop._do_poll: tweak EINTR handlingZac Medico2012-02-131-13/+14
| | | | | | | 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.
* EventLoop: make _poll/_run_timeouts re-entrantZac Medico2012-02-131-62/+73
| | | | | | | 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.
* EventLoop.iteration: handle _poll StopIterationZac Medico2012-02-111-1/+7
|
* EventLoop: remove obsolete timeout_add commentZac Medico2012-02-111-7/+0
|
* EventLoop.iteration: run timeouts if no fdsZac Medico2012-02-111-1/+9
|
* EventLoop: shorten iteration poll if timeoutsZac Medico2012-02-111-1/+1
| | | | | | | | | 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().
* GlibEventLoop: use gi.repository.GLibZac Medico2012-02-101-5/+1
|
* EventLoop: name poll constants like glib'sZac Medico2012-02-092-1/+14
| | | | | | 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.
* EventLoop: inherit PollConstantsZac Medico2012-02-091-1/+1
|
* Add global_event_loop() and GlibEventLoop.Zac Medico2012-02-093-0/+58
| | | | | | 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.
* EventLoop: fix inverted may_block logicZac Medico2012-02-081-2/+2
| | | | This caused emerge to consume 100% cpu.
* Move EventLoop to a separate file.Zac Medico2012-02-082-0/+374