TI中文支持网
TI专业的中文技术问题搜集分享网站

sysbios的task切换函数的疑问?

开发6678,使用sysbios,开了两个task,一个用于网络(优先级是5),一个用于信号处理(优先级是4),信号处理完成后,使用Task_yield();进行任务切换,现象是:网络线程不运行了。如果将信号完成后,使用Task_sleep(1);就行任务切换,现象是:网络线程能够运行,但是Task_sleep会休眠信号处理的任务,影响实时性。将两个task的优先级都改为5后,信号处理后的任务切换使用Task_yield和Task_sleep现象同上。请问:能否有一个函数在不同优先级间的任务切换,但是不会休眠task?

Shine:

Task_yield() does not cause a task to block.  It causes it to change states from "running" to "ready".  This means that if there is another thread of the same priority that was already in a "ready" state then that thread will run.  If only lower priority threads are ready then the current task will continue to run (i.e. it will immediately switch back from "ready" to "running" since it will be the highest priority "ready" task in the system).

赞(0)
未经允许不得转载:TI中文支持网 » sysbios的task切换函数的疑问?
分享到: 更多 (0)