BloombergLP::bslmt::ThreadGroup

Container for managing a group of joinable threads.

Synopsis

Declared in <bslmt_threadgroup.h>

class ThreadGroup;

Description

This class provides a simple mechanism for managing a group of joinable threads. The destructor ensures that any running threads are detached so that resources are not leaked. This class is thread-enabled, thread-safe, and exception-neutral.

Member Functions

NameDescription
ThreadGroup [constructor]Create an empty thread group.
~ThreadGroup [destructor]Destroy this object. Any threads not joined will be allowed to run independently, and will no longer be joinable.
addThread addThread overloads
addThreads addThreads overloads
joinAll Block the calling thread until all threads started in this group have finished executing.
numThreads Return a snapshot of the number of threads started in this group that have not been joined.