Schedules an event that executes function f with argument a
after delay t usec; t 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
f. Note that even after an event fires and a thread had 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 f, void*
a, int t)
typedef void (* EvFunc )
( Event, void * )
Function f 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 f must
begin by casting its second argument to be a non-void type.
Releases a handle to an event. As soon as f completes, the
internal resources associated with the event are freed. All events
should eventually be either detached or canceled
to assure that system resources are released.
void evDetach (Event e)
Cancels event e and returns EVENT_FINISHEDif the event has
already happened, EVENT_RUNNINGif the event is currently running, and
EVENT_CANCELLEDif the event has not run and can be guaranteed to not
run. In the case where evCancel returns EVENT_RUNNING, the
caller must be careful to not delete resources required by the event.
EvCancelReturn evCancel (Event e)
Returns true if an evCancel has been performed on the event.
Because event handlers receive their event as the first calling
argument, it is possible for a handler to check for cancellation
of itself from other threads.
int evIsCancelled (Event e)
Displays a ps-style listing of x-kernel threads in x-kernel's compiled
with DEBUG mode. The address of the entry function, the thread state
(pending, scheduled, running, finished, or blocked), the
time relevant to the thread state, and flags (detached or cancelled), are
displayed for each thread controlled by x-kernel monitor. The meaning
of the time entry varies according to the state. For pending threads,
the time is the time until it will be scheduled; for other states
it is the time the thread has spent in that state. The time is reset
on each transition, i.e., it is not cumulative.
void evDump (void)
evDetach
evCancel
evIsCancelled
evDump
Next: Usage Rules
Up: Event Library
Previous: Type Definitions