106
K
A
DAK
AMX Event Manager
Events are signalled by tasks, ISPs and Timer Procedures. The event is signalled with a
call to procedure ajevsig. The caller specifies the group id of the event group which
contains the particular event. More than one event can be signalled in a single call to
ajevsig. The caller specifies a 16-bit mask identifying the particular event flags in the
group and a 16-bit value which specifies the new state of each of these selected event
flags.
Whenever an event is signalled, the Event Manager determines if any tasks are waiting
for any of the events in the particular group. If tasks are waiting on the group, the Event
Manager checks the new state of the event flags to see if the event match criterion of any
of the waiting tasks has been achieved. Whenever an event match is detected, the Event
Manager wakes the task whose match criterion has been met. Providing that no tasks of
higher priority are executing, the task will resume execution with an indication that the
event combination for which it was waiting has occurred.
If a task needs to know the exact state of the event flags at the time its event match
occurred or timed out, it can issue a call to the Event Manager procedure ajevnt.
A task, ISP or Timer Procedure can determine the current state of the event flags at any
instant with a call to ajevrd.
If an event group is no longer required, the group can be deleted with a call to the Event
Manager procedure ajevdel. The Event Manager will free the event group for reuse.
The Event Manager will not allow you to delete an event group which has one or more
tasks still waiting for events in the group.
You must be absolutely certain that no task, ISP or Timer Procedure is referencing the
event group just as you go to delete it. Be aware that the event group id may immediately
be reused by AMX for some other purpose.