SWI_restorepri
Application Program Interface
2-447
C Interface
Syntax
SWI_restorepri(key);
Parameters
Uns
key;
/* key to restore original priority level */
Return Value
Void
Reentrant
yes
Description
SWI_restorepri restores the priority to the SWI's priority prior to the
SWI_raisepri call returning the key. SWI_restorepri can be used in
conjunction with SWI_raisepri to provide a mutual exclusion mechanism
without disabling all SWIs.
SWI_raisepri should be called right before the shared resource is
referenced, and SWI_restorepri should be called after the reference to
the shared resource.
Constraints and
Calling Context
❏
SWI_restorepri cannot be called from an HWI or TSK level.
❏
SWI_restorepri cannot be called from the program’s main() function.
Example
/* raise priority to the priority of swi_1 */
key = SWI_raisepri(SWI_getpri(&swi_1));
--- access shared resource ---
SWI_restore(key);
See Also
SWI_restorepri
Restore a SWI’s priority