Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

  1. 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 Usage

Code Block
titleOSSchedLock() 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" */
                  :
                  :
              }
          }