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:如何停止调度程序?

Guru**** 2614265 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/771748/rtos-how-to-stop-the-scheduler

工具/软件:TI-RTOS

在某个时候、我需要执行当前任务、而不是切换到其他任务、尽管其他任务具有更高的优先级并准备好执行。 如何临时停止任务切换、但必须处理中断。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Juvf、

    通常用于此目的的一种技术是临时提高正在运行的任务的优先级、使其高于每个其他任务的优先级:

    Int myNormalPriority;
    
    mynormalPriority = Task_getPri (Task_self ());
    
    /*提高我的优先级、使我不能被挤占*/
    Task_setPri (Task_self ()、15);
    
    /*在这里做关键工作... *
    
    /*将我的优先级恢复为正常*/
    Task_setPri (Task_self ()、mynormalPriority);
    
    

    Alan