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.

If you don't know if interrupts are currently disabled, you can use ctl_global_interrupts_set. This will either disable or enable interrupts, depending on the parameter, and will return the previous interrupt-enable state:

int en = ctl_global_interrupts_set(0); // 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.