This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS: how to stop the scheduler?

Tool/software: TI-RTOS

At some point, I need the current task to be executed and not to switch to other tasks, despite the fact that other tasks are more priority and ready to be performed. How to temporarily stop task switching, but interrupts must be handled.

  • Juvf,

    A technique often used for this purpose is to temporarily raise the priority of the running task such that it is higher than the priority of every other task:

        Int myNormalPriority; 
    
        myNormalPriority = Task_getPri(Task_self());
    
        /* increase my priority so that I can't be pre-empted */
        Task_setPri(Task_self(), 15);
    
        /* do the critical work here ... */
    
        /* restore my priority back to normal */
        Task_setPri(Task_self(), myNormalPriority);
    
    

    Alan