I'm working on a project,using VxWorks to create a real-time embedded system,I have a task that creates 3 other tasks using taskSpawn,and to share resources between them,I opted for binary semaphore, but that has proven to be very challenging.
while(1)
{
condition = either situation1 or situation2
if (situation1 is true)
{
pause for x secs,
}
if (situation2 is true)
{
semGive(semID);
break;
}
}
}
void Task2()
{
semTake(semID, WAIT_FOREVER);
pause for x secs;
do something;
pause for x secs);
do something;;
}
In the above code, main() creates 2 tasks(Task1 and Task2)
Task1() creates a semaphore and give semaphore to Task2 if one of the condition is true
Task2() takes semaphore and do task .
All this happens once,I would like my code to continue doing the activity