Unless you have fancy code, you should not encounter this (for the most part), but watch out for race conditions and locking.
if I have task A and it is running:
Code:
CRITICAL_REGION(Sem1)
Wait(5.0);//demo purposes
CRITICAL_REGION(Sem2)
/*Code here*/
END_REGION
END_REGION
and you have Task B running:
Code:
CRITICAL_REGION(Sem2)
Wait(5.0);//demo purposes
CRITICAL_REGION(Sem1)
/*Code here*/
END_REGION
END_REGION
Assuming they were started within 5 seconds of each other, they will both lock, and nothing will happen. Why?
Task A locks Sem1 and waits for 5 seconds, where Task B starts, and Locks Sem2
Task A has waited 5 seconds, and tries to lock Sem2, but Task B has it, so It waits for B to release it.
Meanwhile, B has waited its 5 seconds, and tries to Lock Sem1, but Task A has it so it waits for A to release it.
they are each waiting for the other to do something, so they do nothing