#include "FWCore/Concurrency/interface/SerialTaskQueue.h"
Description: Runs only one task from the queue at a time
Usage: A SerialTaskQueue is used to provide thread-safe access to a resource. You create a SerialTaskQueue for the resource. When every you need to perform an operation on the resource, you push a 'task' that does that operation onto the queue. The queue then makes sure to run one and only one task at a time. This guarantees serial access to the resource and therefore thread-safety.
The 'tasks' managed by the SerialTaskQueue are just functor objects who which take no arguments and return no values. The simplest way to create a task is to use a C++11 lambda.
Example: Imagine we have the following data structures.
On thread 1 we can fill the vector
While on thread 2 we periodically print and stop when the vector is filled