Module a.reactor

Part of aculab View Source

Utilities for portable event handling.

The portable event handling is uglier than I'd like it, but the situation is complicated:

On Windows, tSMEventId is a typedef to HANDLE. On Unix, it is a structure with an fd and a mode member.

On Unix, we need the mode when adding the event, so it would seem ideal to always pass tSMEventId instances around and deal with the differences in the reactor implementations.

But that doesn't work, because the RTP related VMPrx etc. manage their own events, and delete them as soon as they are stopped, so for RTP on Unix we can't keep references to tSMEventIds around - it is only safe to keep a reference to the file descriptor.

This is ++ungood, but after more than a decade I have given up hope Aculab would pay attention to details or be at least consistent.

The following strategy is currently used:

We have add_event and remove_event functions in this module.

add_event returns a handle that can be passed directly to reactor.remove. The VMPrx etc. store this value and call reactor.remove() directly.

remove_event takes a tSMEventId as event parameter. This is used by the SpeechChannel that manages its events explicitly.
Class CallEventThread This is a helper thread class for call events on v5 drivers.
Function shutdown_call_event_thread Undocumented
Function dispatch Undocumented
Function call_dispatch Map a call event to the methods on the Call and Controller and call it.
Function call_on_event Undocumented
Function add_call_event Add a call event to the reactor.
Function remove_call_event Undocumented
Class PortEventDispatcher Placeholder - not currently used.
def shutdown_call_event_thread(): (source)
Undocumented
def dispatch(controller, method, *args, **kwargs): (source)
Undocumented
def call_dispatch(call, event): (source)

Map a call event to the methods on the Call and Controller and call it.

Methods on the Call object (if available) are called first, then methods on the controller.

The Call object can have a special _post method for each event that is called last.
def call_on_event(call): (source)
Undocumented
def add_call_event(reactor, call): (source)
Add a call event to the reactor.
def remove_call_event(reactor, call): (source)
Undocumented
API Documentation for pyAculab, generated by pydoctor at 2009-01-02 15:12:29.