Home | Libraries | People | FAQ | More |
boost::thread_group — The thread_group class provides a container for easy grouping of threads to simplify several common thread creation and management idioms.
class thread_group : private boost::noncopyable // Exposition only { public: // construct/copy/destruct thread_group(); ~thread_group(); // modifier thread* create_thread(const boost::function0<void>&); void add_thread(thread* thrd); void remove_thread(thread* thrd); void join_all(); };
thread_group
construct/copy/destructthread_group();
Effects: Constructs an empty thread_group container.
~thread_group();
Effects:
Destroys each contained thread object. Destroys *this
.
Notes:
Behavior is undefined if another thread references
*this
during the execution of the destructor.
thread_group
modifierthread* create_thread(const boost::function0<void>& threadfunc);
Effects:
Creates a new thread object
that executes threadfunc
and adds it to the
thread_group
container object's list of managed
thread objects.
Returns:
Pointer to the newly created
thread object.
void add_thread(thread* thrd);
Effects:
Adds thrd
to the
thread_group object's list of managed
thread objects. The thrd
object must have been allocated via operator new
and will
be deleted when the group is destroyed.
void remove_thread(thread* thrd);
Effects:
Removes thread
from *this
's
list of managed thread objects.
Throws:
??? if
thrd
is not in *this
's list
of managed thread objects.
void join_all();
Effects:
Calls join()
on each of the managed
thread objects.
Copyright © 2001-2003 William E. Kempf |