我想重新实现 vxWorks 函数 taskLock() 和 taskUnlock()。
这是vxWorks功能的原始描述。
* taskUnlock - enable task rescheduling
*
* This routine decrements the preemption lock count. Typically this call is
* paired with taskLock() and concludes a critical section of code.
* Preemption will not be unlocked until taskUnlock() has been called as many
* times as taskLock(). When the lock count is decremented to zero, any tasks
* that were eligible to preempt the current task will execute.
*
* The taskUnlock() routine is not callable from interrupt service routines.
我使用 pthreads 重新实现 vxWorks 任务。那么有没有可能做到这一点?
如果我理解正确。如果一个函数调用了taskLock,那么在调用taskunlock之前,下面的代码不会中断。
我在网上没有找到解决方案。