In reply to kitanisi:
In reply to Sriram Yalavatti:
In short, latest example uses semaphore to align events.
First example is w/o semaphore.
what if no semaphore in latest one ?
If there is no semaphore, then as i told the threads will execute based on the call in sequential order. For better analysis kindly work on the code at least once in the simulator.