BloombergLP::bslmt::ThreadGroup

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.

Synopsis

Declared in <bslmt_threadgroup.h>

class ThreadGroup;

Member Functions

NameDescription
ThreadGroup [constructor]Create an empty thread group. Optionally specify basicAllocator will be used to supply memory. If basicAllocator is 0, the currently installed default allocator will be used.
~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.