#include <FWCore/Concurrency/interface/WaitingTaskList.h>
Description: Handles starting tasks once some resource becomes available.
Usage: This class can be used to have tasks wait to be spawned until a resource is available. Tasks that want to use the resource are added to the list by calling add(oneapi::tbb::task*). When the resource becomes available one calls doneWaiting() and then any waiting tasks will be spawned. If a call to add() is made after doneWaiting() the newly added task will immediately be spawned. The class can be reused by calling reset(). However, reset() is not thread-safe so one must be certain neither add(...) nor doneWaiting() is called while reset() is running.
An example usage would be if you had a task doing a long calculation (the resource) and then several other tasks have been created in a different thread and before running those new tasks you need the result of the long calculation.
In one part of the code we can setup the shared resource
In another part we can start the calculation
Finally in some unrelated part of the code we can create tasks that need the calculation