Locking the Scheduler
It is possible for a task to lock the scheduler and thus prevent preemption. In other words, locking the scheduler makes the current task the highest priority task. This is accomplished by calling OSSchedLock(). To unlock the scheduler, you simply call OSSchedUnlock().
Interrupts are still recognized when the scheduler is locked but the kernel will not switch to a higher priority task while the scheduler is locked. It's generally not recommended to lock the scheduler in your application because it defeats the purpose of having the kernel manage your tasks.