58
K
A
DAK
Interrupt Service Procedures
Semaphore Synchronization
The AMX Semaphore Manager provides an even more powerful synchronization
capability. It provides the automatic timeout facility and also allows more than one task
to wait for the same event, with each task determining its own waiting priority.
Furthermore, the Interrupt Handler need not know the identity of the waiting tasks (if
any) or their chosen waiting priorities. The AMX Semaphore Manager will
automatically ensure that the task with the highest waiting priority is given access to the
semaphore first.
Synchronization using counting semaphores with an initial count of zero is achieved as
follows. A task issues an ajsmwat call indicating the maximum interval for which it is
willing to wait for the semaphore and its chosen waiting priority. When the interrupt
occurs, the Interrupt Handler issues an ajsmsig call to wake up the task with the highest
waiting priority that is blocked on the semaphore. The task will always know when it
resumes execution whether the event actually occurred or whether the maximum wait
interval elapsed.
Event Group Synchronization
The AMX Event Manager provides another form of synchronization. It allows more than
one task to be waiting for a specific event or for a combination of events. It also provides
the automatic timeout facility. The Interrupt Handler does not have to know which tasks
(if any) are waiting for its event.
Synchronization using an event group is achieved as follows. A task clears an event flag
in an event group and then issues an ajevwat call indicating the maximum interval it is
willing to wait for the event to occur. The Interrupt Handler issues an ajevsig call to set
the particular event flag for which it is responsible. The Event Manager then allows all
tasks which are waiting for that particular event flag to be set to resume execution. The
task will always know when it resumes execution whether the event actually occurred or
whether the maximum wait interval elapsed.
Message Exchange Synchronization
An Interrupt Handler can communicate with a task by sending a message to a message
exchange. The AMX Message Exchange Manager allows more than one task to wait for
a message from a message exchange with each task determining its own wait priority and
maximum wait interval. An Interrupt Handler does not need to know the identity of the
waiting tasks (if any) or their chosen waiting priorities.
Synchronization via a message exchange is achieved as follows. A task calls ajmxwat to
wait on a particular message exchange indicating the priority of its request and the
maximum interval it is willing to wait for a message to arrive.
When the interrupt occurs, the Interrupt Handler calls ajmxsnd to send a message to the
message exchange. The Message Exchange Manager delivers the message to the task
and allows the task to resume execution. If no interrupt occurs before the timeout
interval expires, the AMX Kernel Task will force the task to resume execution with a
timeout indication.