Part Number:CC2642R
如题。
在一些外设的驱动程序中,需要延时的情况很常见。我主要是担心主进程会被 Task_Sleep() 阻塞,连蓝牙服务都会受到影响。
Kevin Qiu1:
会阻塞,查看下面的说明:
Name: Task_sleepPrototype: Void Task_sleep( UInt32 nticks );Description:Delay execution of the current task
Task_sleep changes the current task's mode from Mode_RUNNING to Mode_BLOCKED, and delays its execution for nticks increments of the system clock. The actual time delayed can be up to 1 system clock tick less than nticks due to granularity in system timekeeping and the time elapsed per tick is determined by Clock_tickPeriod.
,
Robin Luo:
谢谢,有具体的说明文档的连接吗?有什么好的方法,既能延时又不会阻塞主进程的队列运作的?
,
Kevin Qiu1:
可在文档中搜索查看:https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_5_40_00_40/docs/tirtos/sysbios/docs/Bios_User_Guide.pdf
Task_sleep只是阻塞当前任务,对于该任务本身来说和普通的等待delay是一样的,一般来说,主任务的优先级都比较高,所以不会影响主任务运行
,
Robin Luo:
是的。我的观点和你的观点是一样的。Task_sleep() 应该只是使 CPU 脱离了当前的代码段,而去执行其他的代码段而已。在主队列的事件回调函数中使用 Task_sleep() 应该并不会影响队列中其他事件的处理。
,
Kevin Qiu1:
是的