next up previous contents index
Next: Map Library Up: Event Library Previous: Event Operations

Usage Rules

 

Repeating Events

 

Each event that is scheduled executes at most one time. Repeating events are programmed as illustrated in Figure 3.

 
Figure 3: Repeating events  

Cancellable Events

 

The evIsCancelled routine is designed to make it easy to write events which might be cancelled before (or while) they run. It is common practice, for example, for a session to pass session state to a timeout event. The evIsCancelled notification can be used to synchronize the timeout event and the possible destruction of the session state. An example is given in Figure 4.

 
Figure 4: Cancellable events  

Event Granularity

 

Although the event library uses an efficient representation (timing wheels) protocol programmers should be careful to not schedule events that are too fine grained. For example, in TCP, it is better to schedule one event for every session rather than for every message that is sent.



Larry Peterson
Tue Jul 1 14:50:34 MST 1997