Parallel
critical.txt
Associated article: Apply Critical Sections Consistently
Tags:
Published source code in the article by Herb Sutter in which he examines critical code sections for guaranteeing mutual exclusion on shared variables.
Effective Concurrency by Herb Sutter // One Producer thread // while( there are more tasks ) { task = AllocateAndBuildNewTask(); mut.lock(); // enter critical section queue.push( task ); // add new task mut.unlock(); // exit critical section } mut.lock(); // enter critical section queue.push( done ); // add ...