next up previous contents index
Next: evDetach Up: Event Operations Previous: Event Operations

evSchedule

   

Schedules an event that executes function func with argument arg after delay usec microseconds; usec may equal 0. A handle to the event is returned, and this can be used to cancel the event at some later time. When an event fires, a new thread is created to run function func. Note that even after an event fires and a thread has been scheduled to handle it, the thread does not run until sometime after the currently executing thread gives up the processor. See Section 7 for a description of how threads are scheduled.

Event evSchedule(EvFunc func, void *arg, unsigned usec)

typedef void (*EvFunc)(Event event, void *arg)

Function func must be of type void and take two arguments: the first, of type Event, is a handle to the event itself, and the second, of type void *, is the argument passed to evSchedule. In order to satisfy the C compiler type checking rules when accessing the arguments, function func must begin by casting its second argument to be a non-void type.



Larry Peterson
Wed Jan 10 10:40:08 MST 1996