OSSchedUnlock
Description
OSSchedUnlock()
re-enables task scheduling whenever it is paired with OSSchedLock()
.
Files
os.h/os_core.c
Prototype
void OSSchedUnlock (OS_ERR *p_err)
Arguments
p_err
is a pointer to a variable that will contain an error code returned by this function.
OS_ERR_NONE
the call is successful and the scheduler is no longer locked.
OS_ERR_OS_NOT_RUNNING
If calling this function before calling OSStart()
.
OS_ERR_SCHED_LOCKED
If the scheduler is still locked. This would indicate that scheduler lock has not fully unnested.
OS_ERR_SCHED_NOT_LOCKED
If the user did not call OSSchedLock()
.
OS_ERR_SCHED_UNLOCK_ISR
If OS_CFG_CALLED_FROM_ISR_CHK_EN
set to DEF_ENABLED
in os_cfg.h
: if you attempted to unlock scheduler from an ISR.
Returned Value
None
Required Configuration
None
Callers
Application.
Notes/Warnings
None
Example Usage
OSSchedUnlock() example usage
void TaskX (void *p_arg) { OS_ERR err; (void)&p_arg; while (DEF_ON) { : OSSchedLock(&err); /* Prevent other tasks to run */ /* Check "err" */ : : /* Code protected from context switch */ : OSSchedUnlock(&err); /* Enable other tasks to run */ /* Check "err" */ : : } }