A SERVICE OF

logo

Thread Blocking
149
Figure 13-2 Blocking Action of Multiple Threads
The general order of events displayed in Figure 13-2 is as follows:
1. The application and draw threads are created and initialized.
2. The draw threads try to render but are stopped.
3. The application thread modies the scene graph.
4. The scene graph is cleaned using csField::cleanFields().
5. The application thread enters the Draw Barrier (semaphore) when it is ready to
render the scenes.
6. The application thread tries to run but is stopped by the Swap Barrier until all draw
threads have run.
7. The remainder of the draw threads run.
8. The draw threads enter the Swap Barrier.
9. when all threads enter the Swap Barrier they are released. The draw threads
immediately enter the Draw Barrier and block.
10. The application thread modies the scene graph.
11. The procedure repeats itself starting again at step 4.
Time
Modify
scene graph
Draw
image
Modify
scene graph
Draw
image
Draw barrier
Swap barrier
Draw
threads
Application
thread