Hi All,
I am using SYS/BIOS 6.32 and would like to protect a data structure which is shared between different tasks. I consider Hwi_disable vs Task_disable, however what I read about them in different resources a little bit confused my mind.
From cdoc of SYS/BIOS module, Disabling Threads section of Synchronizing DSP/BIOS Threads and http://e2e.ti.com/support/embedded/f/355/p/68413/247705.aspx#247705 post I understood that;
* Hwi_disable can prevent preemption, EXCEPT the critical section itself (the task currently running) makes a function call which cause a context switch. Otherwise a contect switch is not possible?
key = Hwi_disable();
....
Semaphore_post(...); //This may cause a context switch, RIGHT?
Hwi_restore(key);
* If I want to COMPLETELY disable context switching I SHOULD use Task_disable() in order to prevent the scheduler to a change the RUNNING task?? For example in the example above If I use Task_disable before Hwi_disable() and Task_restore() after Hwi_restore, there will be no context switch until the end of Task_restore? Whenever Task_restore is called a context swtich may occur if a waiting high priority tasks exists?
* Cdoc documentation states that, In the Task_disable/restore block calling Task_sleep or Task_yield can cause blocking. Is it a result of preventing the scheduler from making a context switch due to the Tak_disable() ??
I am not sure if I understood these rules correctly or not. I appreciate your opinions.
Best Regards