CTL provides functions that enable and disable the global interrupt enables of the processor. CTL uses this mechanism when accessing the task list. It can also be used to provide a fast, mutual-exclusion facility for time-critical uses.
You can disable interrupts by using ctl_global_interrupts_disable and you can enable interrupts by using ctl_global_interrupts_enable.
int en = ctl_global_interrupts_disable(); // disable ⁞ if (en) ctl_global_interrupts_enable(); // set to previous state
You can call a tasking library function that causes a task switch with global interrupts disabled. The tasking library will ensure that, when the next task is scheduled, global interrupts are enabled.