After all registrations are finished, an application typically turns over control to EMan and is completely event driven thereafter. Typically, an application main program ends with the following call to EMan:
_someProcessEvents(some_gEMan, Ev);
An equivalent way to process events is to write a main loop and call someProcessEvent from inside the main loop, as indicated:
while (1) { /* do forever */ _someProcessEvent( some_gEMan, Ev, EMProcessTimerEvent Æ EMProcessSinkEvent Æ EMProcessClientEvent Æ EMProcessWorkProcEvent ); /*** Do other main loop work, as needed. ***/ }
The second way allows more precise control over what type of events to process in each call. The example above enables all four types to be processed. The required subset is formed by logically OR'ing the appropriate bit constants (these are defined in "eventmsk.h)". Another difference is that the second way is a non-blocking call to EMan. That is, if there are no events to process, control returns to the main loop immediately, whereas someProcessEvents is a non-returning blocking call. For most applications, the first way of calling EMan is better, since it does not waste processor cycles when there are no events to process.