narayan_ak wrote on Tuesday, April 29, 2008:
Dear all,
I have a situation which I am trying to undertand. The scenario is something like below.
I have two tasks task_A and task_B
A binary semaphore ABC is created.
task_A( )
{
A();
delay 100ticks
}
task_B( )
{
B();
delay 100ticks
}
A( )
{
if(xSemaphoreTake( ABC, portMAX_DELAY ) == pdTRUE )
{
// do something
xSemaphoreGive( ABC );
taskdelay (25 ms; //Note delay here
}
else
{
printf("Task A Error");
}
}
B( )
{
if(xSemaphoreTake( ABC, portMAX_DELAY ) == pdTRUE )
{
// do something
xSemaphoreGive( ABC ); //Note NO delay here
}
else
{
printf("Task B Error");
}
}
My setup is configured as 32bits, thereofre portMAX_DELAY will be large. However I see that I get errors "Task B Error".(and Task A error sometimes) Is it possible that the sempahore is timing out even with portMAX_DELAY or am I doing sonmething wrong here?
Any insight will be appreciated. At he moment my workaround is while ((xSemaphoreTake( ABC, portMAX_DELAY ) != pdTRUE ), but I wnat to know what is wrong.
-regards
Narayan