pyre.ipc.Selector

Module Contents

class pyre.ipc.Selector.Selector(**kwds)

Bases: pyre.ipc.Scheduler.Scheduler

An event demultiplexer implemented using the {select} system call.

In addition to supporting alarms via its {Scheduler} base class, {Selector} monitors changes in the state of channels. Processes that hold {Selector} instances can go to sleep until either an alarm rings or a channel is ready for IO, at which point {Selector} invokes whatever handler is associated with the event.

class _event(channel, handler)

Encapsulate a channel and the associated call-back

__slots__ = ['channel', 'handler']
_watching = True
whenReadReady(self, channel, call)

Add {call} to the list of routines to call when {channel} is ready to be read

whenWriteReady(self, channel, call)

Add {call} to the list of routines to call when {channel} is ready to be written

whenException(self, channel, call)

Add {call} to the list of routines to call when something exceptional has happened to {channel}

stop(self)

Request the selector to stop watching for further events

watch(self)

Enter an indefinite loop of monitoring all registered event sources and invoking the registered event handlers

dispatch(self, index, entities)

Invoke the handlers registered in {index} that are associated with the descriptors in {entities}