BloombergLP::bdlmt::ThreadMultiplexor

Mechanism that partitions threads to process user-defined jobs.

Synopsis

Declared in <bdlmt_threadmultiplexor.h>

class ThreadMultiplexor;

Description

This class provides a mechanism for facilitating the use of multiple threads to perform various user-defined functions ("jobs") when some degree of collaboration between threads is required. The thread multiplexor is configured with a total number of "processors", representing the number of threads that may process jobs at any particular time. Additional threads enqueue jobs to a pending job queue, which is processed by the next available processing thread.

Type Aliases

NameDescription
Job A callback of this type may be passed to the processJob method.

Member Functions

NameDescription
ThreadMultiplexor [constructor]Create a thread multiplexor with the specified processor and queue limits.
~ThreadMultiplexor [destructor]Destroy this thread multiplexor object.
maxProcessors Return the maximum number of active processors.
numProcessors Return the current number of active processors.
processJob Process or enqueue the specified job based on available processors.
operator BloombergLP::bslmf::NestedTraitDeclaration<ThreadMultiplexor, UsesBslmaAllocator> Declare that this type uses a bslma allocator.