Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

void OSSchedLock (OS_ERR  *p_err)

File

Called from

Code enabled by

os_core.c

Task only

N/A

OSSchedLock() prevents task rescheduling until its counterpart, OSSchedUnlock(), is called. The task that calls OSSchedLock() retains control of the CPU, even though other higher- priority tasks are ready-to-run. However, interrupts are still recognized and serviced (assuming interrupts are enabled). OSSchedLock() and OSSchedUnlock() must be used in pairs.

µC/OS-III allows OSSchedLock() to be nested up to 250 levels deep. Scheduling is enabled when an equal number of OSSchedUnlock() calls have been made.

Arguments

p_err

is a pointer to a variable that will contain an error code returned by this function.

OS_ERR_NONE

the scheduler is locked.

OS_ERR_LOCK_NESTING_OVF

If the user called this function too many times.

OS_ERR_OS_NOT_RUNNING

If the function is called before calling OSStart().

OS_ERR_SCHED_LOCK_ISR

If OS_CFG_CALLED_FROM_ISR_CHK_EN set to 1 in os_cfg.h: if you attempted to call OSSchedLock() from an ISR.

Returned Value

None

Notes/Warnings

After calling OSSchedLock(), the application must not make system calls that suspend execution of the current task; that is, the application cannot call OSTimeDly(), OSTimeDlyHMSM(), OSFlagPend(), OSSemPend(), OSMutexPend(), or OSQPend(). Since the scheduler is locked out, no other task is allowed to run, and the system will lock up.

Example

  • No labels