Let's call the functional object that takes no arguments (a task, in short).
typedef boost::function<void()> task_t;
And now, imagine a situation where we have threads that post tasks and threads that execute posted tasks. We need to design a class that can be safely used by both types of thread. This class must have methods for getting a task (or blocking and waiting for a task until it is posted by another thread), checking and getting a task if we have one (returning an empty task if no tasks remain), and a method to post tasks.
Make sure that you feel comfortable with
std::thread and know some basics of mutexes.
The classes that we are going to implement will be close in ...