Event Management Framework Reference 5-7
SOMEEMan Class
Description
The Event Manager class (EMan) is used to handle several input events. The main purpose
of this class is to provide a service that can do a blocked (or timed) wait on several event
sources concurrently. Typically, in a main program, one registers an interest in an event type
with EMan and specifies a callback (a procedure or a method) to be invoked when the event
of interest occurs. After all the necessary registrations are complete, the main program ends
with a call to someProcessEvents in EMan. This call is non-returning. EMan then waits on
all registered event sources. The application is completely event driven at this point (that is,
it does something only when an event occurs). The control returns to EMan after processing
each event. Further registrations can be done from within the callback routines.
Unregistrations can also be done from within the callback routines.
For applications that want to have their own main loop, EMan provides a non-blocking call
(the someProcessEvent method), which processes just one event (if any) and returns to
the main loop immediately. Note that when this call is the only one in the application’s main
loop, CPU cycles are wasted in constantly polling for events. In this situation, the
non-returning form of the someProcessEvents call is preferable.
AIX Specifics
On AIX this event manager supports Timer, Sink (any file, pipe, socket, or Message Queue),
Client and WorkProc events.
OS/2 and Windows Specifics
On OS/2 and Windows, this event manager supports Timer, Sink (sockets only), Client, and
WorkProc events.
Thread Safety
To cope with multi-threaded applications on OS/2, the event-manager methods are mutually
exclusive (that is, at any time only one thread can be executing inside of EMan). If an
application thread needs to stop EMan from running (that is, to achieve mutual exclusion
with EMan), it can use the two methods someGetEManSem and someReleaseEManSem
to acquire and release EMan semaphores. On AIX or Windows, since threads are not
supported (at present), calling these two methods has no effect.
File Stem
eman
Base Class
SOMObject
Metaclass
SOMMSingleInstance
Ancestor Classes
SOMObject
Komentarze do niniejszej Instrukcji