There are two types of events in the infrastructure, IO events and Delayed Events.
The Infrastructure uses IO event call-backs to accomplish a lot of it's internal operations (I/O Message arrival and pings, alarms, connections, disconnections, broadcast and clone requests to the sys layer, infrastructure control, system initialization, etc.).
Hence, there is a group of functions which support events which are available to the application programmer.
The programmer may think of these events like software interrupts.
Events are persistent, that is, once an event is registered it will be called each time the triggering event occurrs until it is deregistered.
Caveat: events are chained and the same data is passed to all call-backs, hence, don't modify the input data, the next call-back in the chain may need to see it as it was originally.
Since all I/O message arrival triggers an event with the type determined at the source, an application programmer may send an event to another process on another machine.
Events are supported by the ioWait layer, and ioWait.h has an enumeration of event types. The event paradigm is as follows, an event (call-back) is registered as a specific event type with a context, when that event is triggered (via ioDoEvent), all call-back functions registered to that event type are called. The call-back receives two arguments, the first is the registered context and the second is the triggering option. Event support is done by these functions:
int | ioRegEvent( int type, pfi_t func, void *context ) |
When an event is triggered of type "type", the function "func" is called and passed "context" as an argument, along with an optional argument provided by the triggering call (ioDoEvent()).
CALL-BACK FUNCTION: int ioEvent( void *registeredContext, void *option) |
int | ioDoEvent( int type, void *option ) |
Triggers event type "type" passing "option" along with the registered context to all call-backs registered to this type.
CALL-BACK FUNCTION: int ioEvent( void *registeredContext, void *option) |
int | ioEvent( void *contxt, void *opt) |
The event call-back prototype.
The arguments "contxt" (from the registerer) and "opt" (from the trigger caller) are passed in.
Most call-backs return zero since the logical OR of all called event functions will be returned to the triggering caller.
Event registration is currently persistent (there is no way to unregister an event) but that would be trivial if required. |