158
K
A
DAK
Advanced Topics
13.5 Task Suspend/ResumeSome operating systems permit a task to suspend any task, including itself. This feature
is then used to implement the equivalent of the AMX task wait procedure ajwait.
The ability to arbitrarily suspend a task is one of the most abused privileges afforded by
other operating systems. The AMX philosophy is to encourage well structured task
designs using the wide range of task synchronization facilities offered by AMX in which
there is rarely the need for an uncontrolled task suspension. In most cases, a modification
to your system design can eliminate the apparent need to arbitrarily suspend a task.
To facilitate porting system designs from other operating systems to AMX, the
procedures ajsusp and ajresum are provided.
Any Restart Procedure, task, Timer Procedure or Exit Procedure can suspend any task in
the system except the AMX Kernel Task. ISPs cannot suspend tasks. The task remains
suspended until some task, ISP or Timer Procedure calls ajresum to force resumption of
that task.
If a task is blocked (waiting for a task trigger or AMX message or in any AMX wait
state) at the time it is suspended, the task will remain blocked (suspended) until an
ajresum call attempts to let the task resume. If, while the task was suspended, the
blocking conditions were removed, the task will resume (start) at the point at which it
was blocked.
Note
Do not use ajsusp and ajresum for synchronization.
For task synchronization, see Chapter 3.6.
For ISP synchronization, see Chapter 4.4.