IPC@CHIP® RTOS-LNX – API Documentation
This API prevents the system from switching away from the current task. However, it does not prevent Interrupt Service Procedures from interrupting the current thread.
This function locks the processor to the current task, preventing further task switching until either RTX_Enable_Task_Scheduling() or a sleep or block API function is called. Entering any sleep API defeats the task lock. In this case the task lock condition is released until the task resumes execution. During the sleep, the system automatically releases the lock condition to allow other tasks to execute.
The task lock defeats the task execution time limit and time slicing mechanisms. If either form of time out occurs when the task lock is applied, the affect of the time-out will not be seen until after the lock is released. Consequently, a task's execution time limit will offer no protection against an infinite loop that occurs with task switching locked.
Note that this is implemented as a spin lock, such that if for some reason the task calls here N times then N calls to RTX_Enable_Task_Scheduling() are required to unwind the spin lock before task switching is re-enabled.
Caution: This call must be followed by a call to RTX_Enable_Task_Scheduling() as soon as possible to re-enable the task switching. Should the task lock period be excessive, the system watchdog must be triggered by the user until the task switching is re-enabled.