NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUES | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO
#include <exec/chExec.h>int threadAborted(void);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
CORE
The threadAbort() system call aborts the thread whose local identifier is threadli in the actor whose capability is given by actorcap .
If actorcap is K_MYACTOR , the aborted thread will be in the current actor.
Aborting a thread has different effects, depending on the state of the thread:
If the thread is blocked by an ABORTABLE call, ( threadDelay(2K) ), the thread exits its blocked state and the blocking microkernel call returns a specific error code ( K_EABORT ). The abort has been processed by the thread.
Otherwise (if the thread is running or is blocked by a NON-ABORTABLE call), the thread enters the ABORTED state and the abort must still be processed. Abort processing can take three distinct forms:
When a running thread in the ABORTED state issues an ABORTABLE blocking call ( semP(2K) ), it does not enter the blocked state. The blocking call returns the specific error code K_EABORT immediately and the thread quits the ABORTED state (the abort has been processed by the thread).
A running thread can invoke the threadAborted() system call at any time, in order to test whether it is in the ABORTED state. If the thread is in the ABORTED state, threadAborted() resets this state and returns 1 (the abort has been processed by the thread). Subsequent calls to threadAborted() will return 0 (if the thread is not aborted again).
Finally, SUPERVISOR actors may also be informed via a asynchronous handler call, when threads enter the ABORTED state, using svAbortHandler(2K_I) . In this case, when the thread in the ABORTED state returns to execute within its home actor execution environment (see svTrapConnect(2K) ), the actor's abort handler is invoked, if any, and the thread quits the ABORTED state (the abort has been processed by the actor). Consequently, calls to threadAborted() from the thread will return 0 (if the thread is not aborted again).
When a thread returns from any non-abortable microkernel call, if another thread has aborted the thread (i.e. threadAbort() has been applied to this thread) the abort state is silently cleared by the microkernel. For instance, if a low priority thread A calls semV() and wakes up a high priority thread B, and if this latter calls threadAbort() on thread A, the microkernel will clear the abort state when thread A returns from semV() .
On successful completion, threadAbort() returns 0 . Otherwise, a negative error code is returned.
The threadAborted() call returns 1 if the current thread is in the ABORTED state, 0 if not.
When a thread A is aborted while it is running in its home actor by another thread B, if thread A calls a abortable system call it will not return K_EABORT , but its abort exception handler will be triggered. Consequently K_EABORT is returned if only and only if the thread is blocked into an abortable microkernel call when threadAbort() is applied to it.
actorcap is an inconsistent actor capability, or threadli is not a valid thread identifier in the specified actor.
actorcap does not specify a reachable actor.
Some of the data provided are outside the current actor's address space.
The target actor and the current actor must be located on the same site.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUES | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO