...
Files
os.h/os_core.c
Prototype
Code Block |
---|
void OSSchedLock (OS_ERR *p_err) |
Arguments
p_err
is a pointer to a variable that will contain an error code returned by this function.
...
- After calling
OSSchedLock()
, the application must not make system calls that suspend execution of the current task; that is, the application cannot callOSTimeDly()
,OSTimeDlyHMSM()
,OSFlagPend()
,OSSemPend()
,OSMutexPend()
, orOSQPend()
. Since the scheduler is locked out, no other task is allowed to run, and the system will lock up.
Example Usage
Code Block | ||
---|---|---|
| ||
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" */
:
:
}
} |