16
K
A
DAK
General AMX Operation
Message Queuing
One of the more powerful features of AMX is its ability to queue messages for tasks.
The queuing facility permits messages to pile up in a controlled fashion, freeing the ISP,
Timer Procedure or task which is sending the message to continue with its appointed
function. If a task sends a message, it can suspend itself until the message has been
received and processed by some other task.
The AMX message queuing facility is further enhanced by allowing the messages to
queue at any of four priority levels. A task can therefore receive messages from a variety
of callers with the messages already sorted in order of priority by AMX.
The system designer describes the exact message queuing requirements in a task
definition or in a message exchange definition. For each task and message exchange, you
can specify which, if any, of the four message queuing priority levels are to be supported.
You also specify the required message nesting depth for each of these message queues,
often referred to as mailboxes.
AMX maintains a free list of message envelopes. These envelopes are used by AMX to
transmit messages to the mailboxes of tasks and message exchanges. The caller's
message parameters are moved into a free envelope which is then added to the message
queue of the destination task mailbox or message exchange mailbox.
The AMX message queuing facility is especially useful in event logging applications. In
such applications, messages are transmitted to a printing task by any task wishing to log
an event. The printing task is then executed once for each unique request which it has
received. High priority messages can easily be forced to precede low priority messages
using the AMX message priority feature. Finally, any task wishing to wait until its
particular message has been logged can do so by informing AMX of its intent at the time
the message is sent.
AMX Shutdown
An AMX system can be shut down in the same orderly fashion in which it was started. A
task initiates a shutdown with a call to the AMX exit procedure ajexit.
It is the caller's responsibility to assure that the AMX system is in a reasonable state to
permit a shutdown. For instance, all device I/O operations should be stopped and all
timing activity should be curtailed.
The AMX shutdown procedure executes a series of user Exit Procedures which can
restore the original environment which existed prior to starting the AMX system. Device
interfaces can be reprogrammed and interrupt vectors restored if necessary.
Once all of the Exit Procedures have been executed, AMX returns to the point at which
AMX was originally launched.