solutely need to make use of multiple critical regions to protect your code, we suggest you use the global critical region.</p>
<p>In the following example code we show how one might use critical regions to protect the traversal of a linked list, testing to find the first element whose values is equal to "val". If this code were not protected, another thread which was modifying the linked list could invalidate assumptions in the traversal code.</p>
<div class="fragment"><div class="line"><a class="code" hre