PxExpectAbort()
Call a function and expect abort during the call.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxEvents_t PxExpectAbort (PxEvents_t ev, void func, parms...); - ARGUMENTS
|
|
|
|
|
- RETURN VALUES
-
-
Events that made the call return
-
- DESCRIPTION
-
PxExpectAbortenables the abort mechanism and calls the function func() with the specified argument. This call is aborted andPxExpectAbortreturns prematurely provided that:-
One of the events specified in events is saved for task and there is no intervening active call to
PxExpectAbort,PxAwaitEventsor aPxResetEventsservice or a call with the_EvWaitsuffix (nested in func). -
The abort mechanism is enabled.
Otherwise,
PxExpectAbortreturns when the call returns. If the call has been aborted,PxExpectAbortreturns the events which led to abortion and clears them from the saved events (as they have been handled). If the call was not aborted,PxExpectAbortreturns 0.If the function call is aborted,
PxExpectAbortmust restore the context to its state before activation. Thus,PxExpectAbortsaves the context in an abort frame taken from the tasks abort stack. This abort frame is released whenPxExpectAbortreturns. As this implies, the task must provide one abort frame for each nestedPxExpectAbortcall. The size of the abort frames are processor dependent and defined in the constantPxAbortFrameSize.During their activation, nested
PxExpectAbortcalls disable the effects of an enclosingPxExpectAbortcall. The current effective aborting events can be obtained via a call toPxGetAbortingEvents. On return from thePxExpectAbortalso 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
PxSetModebitsand enabled withPxClearModebitsor with a newPxExpectAbortcall. -
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
The parameter
evcontains 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 }