Guard Functors
You can also specify a guard functor for each runnable instance that you pass to a runnable server. This guard functor is invoked by the runnable server prior to dequeuing a runnable for execution. If the function called by the functor returns false, the runnable is left on the internal runnable queue. Otherwise, if the function returns true, the runnable is dequeued and dispatched.
The runnable server traverses its input queue, evaluating each runnable’s guard until an executable runnable is found. If none of the currently queued runnables can execute, the server waits for another runnable to be queued, and when that happens, repeats the guard evaluation process.
Functors are covered in detail in
Chapter 8, The Functor Package.