A.5 Using the critical Directive
The following example includes several critical directives (Section 2.6.2 on page 18). The example illustrates a queuing model in which a task is dequeued and worked on. To guard against multiple threads dequeuing the same task, the dequeuing operation must be in a critical section. Because the two queues in this example are independent, they are protected by critical directives with different names, xaxis and yaxis.