LOSTISLAND
Member level 3
Hi all ,
I thought the only differences between a Mutex and a semaphore are the count(Semaphore Capability) and priority inversion(Mutex Capability) .
Today , I’ve encountered something strange which maybe is related to the priority inversion capability or something else .
Getting and releasing Mutex or Semaphores between different tasks is clear but when I use them in just one task , their behavior is different .
Using semaphore the task is locked but using Mutex the task is not locked .
Imagine there is just one task called APP_TestTask
Is it something natural or a bug ?
Thanks in advanced
I thought the only differences between a Mutex and a semaphore are the count(Semaphore Capability) and priority inversion(Mutex Capability) .
Today , I’ve encountered something strange which maybe is related to the priority inversion capability or something else .
Getting and releasing Mutex or Semaphores between different tasks is clear but when I use them in just one task , their behavior is different .
Using semaphore the task is locked but using Mutex the task is not locked .
Imagine there is just one task called APP_TestTask
Code:
__task void APP_TestTask (void)
{
for (;;)
{
os_dly_wait (20);
os_sem_wait(Sem_Test,0xffff);
os_sem_send(Sem_Test);
os_sem_wait(Sem_Test,0xffff);
os_sem_wait(Sem_Test,0xffff);
Test_Function();
}
}
Code:
_task void APP_TestTask (void)
{
for (;;)
{
os_dly_wait (20);
os_mut_wait(Mut_Test,0xffff);
os_mut_release(Mut_Test);
os_mut_wait(Mut_Test,0xffff);
os_mut_wait(Mut_Test,0xffff);
Test_Function();
}
}
Thanks in advanced