PxExpectAbort()
Call a function and expect abort during the call.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxEvents_t PxExpectAbort (PxEvents_t ev, void func, parms...);
- ARGUMENTS
|
|
|
|
|
- RETURN VALUES
-
-
Events that made the call return
-
- DESCRIPTION
-
PxExpectAbort
enables the abort mechanism and calls the function func() with the specified argument. This call is aborted andPxExpectAbort
returns prematurely provided that:-
One of the events specified in events is saved for task and there is no intervening active call to
PxExpectAbort
,PxAwaitEvents
or aPxResetEvents
service or a call with the_EvWait
suffix (nested in func). -
The abort mechanism is enabled.
Otherwise,
PxExpectAbort
returns when the call returns. If the call has been aborted,PxExpectAbort
returns the events which led to abortion and clears them from the saved events (as they have been handled). If the call was not aborted,PxExpectAbort
returns 0.If the function call is aborted,
PxExpectAbort
must restore the context to its state before activation. Thus,PxExpectAbort
saves the context in an abort frame taken from the tasks abort stack. This abort frame is released whenPxExpectAbort
returns. As this implies, the task must provide one abort frame for each nestedPxExpectAbort
call. The size of the abort frames are processor dependent and defined in the constantPxAbortFrameSize
.During their activation, nested
PxExpectAbort
calls disable the effects of an enclosingPxExpectAbort
call. The current effective aborting events can be obtained via a call toPxGetAbortingEvents
. On return from thePxExpectAbort
also the task mode is restored and there with the state of the abort mechanism (enabled/disabled).func is a procedure, or PXROS call, with arbitrary arguments. However, any potential return value is lost.
The abort mechanism may be disabled with
PxSetModebits
and enabled withPxClearModebits
or with a newPxExpectAbort
call. -
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
The parameter
ev
contains a bitmask of events awaited and should not be zero. Typically the event mask is a constant (V).
-
- After call
-
-
No checks necessary.
-
- Best Practice
-
-
No restrictions.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" #define MY_EVENT 0x1l PxEvents_t Ev = PxExpectAbort(MY_EVENT, MY_FUNC, OpoolId); if (Ev.error != PXERR_NOERROR) { // Report error }