[#BloombergLP-bslmt]
= xref:BloombergLP.adoc[BloombergLP]::bslmt
:relfileprefix: ../
:mrdocs:

Package namespace for multithreading components&period;

== Types

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/Barrier.adoc[`Barrier`] 
| This class defines a thread barrier&period;
| xref:BloombergLP/bslmt/ChronoUtil.adoc[`ChronoUtil`] 
| This `struct` provides a namespace for utility functions that operate on `bsl&colon;&colon;chrono` facilities&period;
| xref:BloombergLP/bslmt/Condition.adoc[`Condition`] 
| This `class` implements a portable inter&hyphen;thread signaling primitive&period;
| xref:BloombergLP/bslmt/ConditionImpl-02.adoc[`ConditionImpl`] 
| Platform&hyphen;specific condition variable implementation&period;
| xref:BloombergLP/bslmt/Configuration.adoc[`Configuration`] 
| This `struct` provides a namespace for a suite of functions that are used to manage the configuration of default values used in `bslmt`&period; Specifically, these functions manage the default value of thread stack size and provide access to the platform&apos;s native guard size, but may be extended to govern more traits in the future&period;
| xref:BloombergLP/bslmt/EntryPointFunctorAdapter.adoc[`EntryPointFunctorAdapter`] 
| Hold a copy of an instance of parameterized type, along with the allocator used to manage the copy&period; `TYPE` shall have a copy constructor, and declare the `bslma&colon;&colon;UsesBslmaAllocator` trait if it uses `bslma&colon;&colon;Allocator` as an argument to its copy constructor&period;
| xref:BloombergLP/bslmt/EntryPointFunctorAdapterUtil.adoc[`EntryPointFunctorAdapterUtil`] 
| Utility functions for `EntryPointFunctorAdapter`&period;
| xref:BloombergLP/bslmt/EntryPointFunctorAdapter_Base.adoc[`EntryPointFunctorAdapter&lowbar;Base`] 
| This component&hyphen;private type provides a non&hyphen;templated view of `EntryPointFunctorAdapter` for accessing the invoker function&period; Do not use outside this component&period;
| xref:BloombergLP/bslmt/FastPostSemaphore.adoc[`FastPostSemaphore`] 
| This class implements a semaphore type, optimized for `post`, for thread synchronization&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl.adoc[`FastPostSemaphoreImpl`] 
| This class implements a semaphore type, optimized for `post`, for thread synchronization&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImplWorkaroundUtil.adoc[`FastPostSemaphoreImplWorkaroundUtil`] 
| This class provides utility functions for workarounds to system level issues for `FastPostSemaphoreImpl`&period;
| xref:BloombergLP/bslmt/Latch.adoc[`Latch`] 
| This class defines a thread synchronization mechanism that allows one or more threads to wait until a certain number of operations have been performed by other threads&period;
| xref:BloombergLP/bslmt/LockGuard.adoc[`LockGuard`] 
| This class template implements a guard for acquisition and release of synchronization resources (i&period;e&period;, locks)&period;
| xref:BloombergLP/bslmt/LockGuardTryLock.adoc[`LockGuardTryLock`] 
| This class template implements a guard for tentative acquisition and release of synchronization resources (i&period;e&period;, locks)&period;
| xref:BloombergLP/bslmt/LockGuardUnlock.adoc[`LockGuardUnlock`] 
| This class template implements a guard for release and reacquisition of synchronization resources (i&period;e&period;, locks)&period;
| xref:BloombergLP/bslmt/LockReadGuard.adoc[`LockReadGuard`] 
| DEPRECATED&colon; Use `ReadLockGuard` instead&period;
| xref:BloombergLP/bslmt/LockWriteGuard.adoc[`LockWriteGuard`] 
| DEPRECATED&colon; Use `WriteLockGuard` instead&period;
| xref:BloombergLP/bslmt/MeteredMutex.adoc[`MeteredMutex`] 
| This class implements a mutex, that has the additional capability to keep track of hold time and wait time&period; The hold time is defined as the cumulative duration for which the mutex was in the locked state&period; The wait time is defined as the duration for which threads waited for the mutex&period;
| xref:BloombergLP/bslmt/Mutex.adoc[`Mutex`] 
| This `class` implements a lightweight, portable wrapper of an OS&hyphen;level mutex lock to support intra&hyphen;process synchronization&period; The behavior is undefined if the `lock` method of this class is invoked more than once on the same mutex object in the same thread without an intervening call to `unLock`&period;
| xref:BloombergLP/bslmt/MutexImpl-09.adoc[`MutexImpl`] 
| Primary template for platform&hyphen;specific mutex implementations&period;
| xref:BloombergLP/bslmt/Once.adoc[`Once`] 
| Gate&hyphen;keeper class for code that should only execute once per process&period; This class is a POD&hyphen;type and can be statically initialized to the value of the `BSLMT&lowbar;ONCE&lowbar;INITIALIZE` macro&period; For this reason, it does not have any explicitly&hyphen;declared constructors or destructor&period;
| xref:BloombergLP/bslmt/OnceGuard.adoc[`OnceGuard`] 
| Guard class for using `Once` safely&period; Construct an object of this class before conditionally entering one&hyphen;time processing code&period; Destroy the object when the one&hyphen;time code is complete&period; When used this way, this object will be in an &quot;in&hyphen;progress&quot; state during the time that the one&hyphen;time code is being executed&period;
| xref:BloombergLP/bslmt/Platform.adoc[`Platform`] 
| This `struct` provides a namespace for concurrency trait definitions&period;
| xref:BloombergLP/bslmt/QLock.adoc[`QLock`] 
| An efficient statically&hyphen;initializable synchronization primitive that enables serialized access to shared resources&period; Objects of this class can only be manipulated through the use of a `QLockGuard`&period; The following idiom is used to initialize objects of type `QLock`&colon; &grave; QLock mylock &equals; BSLMT&lowbar;QLOCK&lowbar;INITIALIZER&semi; &grave;
| xref:BloombergLP/bslmt/QLockGuard.adoc[`QLockGuard`] 
| This class provides the means to acquire and release the lock on a `QLock` object&period; Typically, the lock is acquired at construction and released automatically on destruction&period; This class also provides explicit `lock`, `tryLock`, and `unlock` primitives&period;
| xref:BloombergLP/bslmt/QLock_EventFlag.adoc[`QLock&lowbar;EventFlag`] 
| &lsqb;*PRIVATE*&rsqb;This class provides a thread&hyphen;safe mechanism for one thread to inform another thread that some event has occurred&period; A flag provides two primary manipulators, `set`, which indicates the event has occurred, and `waitUntilSet`, which waits until that event has occurred (or returns immediately if it has already occurred)&period; A flag is intended to be used by only two threads&colon; a thread setting the flag, and a thread waiting for the flag to be set, and the behavior is undefined if `set` is called while the flag is already set, or if `waitUntilSet` is called while another thread is waiting for the flag&period;
| xref:BloombergLP/bslmt/RWMutex.adoc[`RWMutex`] 
| This class is a platform&hyphen;independent interface to a reader&hyphen;writer lock (&quot;RW mutex&quot;)&period; Multiple readers can safely hold the lock simultaneously, whereas only one writer is allowed to hold the lock at a time&period; This class uses the most efficient RW mutex implementation available for the current platform&period; Note that the implementation may allow readers to starve writers&period;
| xref:BloombergLP/bslmt/RWMutexImpl-0d.adoc[`RWMutexImpl`] 
| Platform&hyphen;specific implementation of a readers&hyphen;writer mutex&period;
| xref:BloombergLP/bslmt/ReadLockGuard.adoc[`ReadLockGuard`] 
| This class template implements a guard for acquisition and release of read synchronization resources (i&period;e&period;, reader locks)&period;
| xref:BloombergLP/bslmt/ReadLockGuardTryLock.adoc[`ReadLockGuardTryLock`] 
| This class template implements a guard for tentative acquisition and release of read synchronization resources (i&period;e&period;, reader locks)&period;
| xref:BloombergLP/bslmt/ReadLockGuardUnlock.adoc[`ReadLockGuardUnlock`] 
| This class template implements a guard for release and reacquisition of read synchronization resources (i&period;e&period;, reader locks)&period;
| xref:BloombergLP/bslmt/ReaderWriterLock.adoc[`ReaderWriterLock`] 
| This class provides a multi&hyphen;reader&sol;single&hyphen;writer lock mechanism&period;
| xref:BloombergLP/bslmt/ReaderWriterMutex.adoc[`ReaderWriterMutex`] 
| This class provides a multi&hyphen;reader&sol;single&hyphen;writer lock mechanism&period;
| xref:BloombergLP/bslmt/ReaderWriterMutexImpl.adoc[`ReaderWriterMutexImpl`] 
| This class provides a multi&hyphen;reader&sol;single&hyphen;writer lock mechanism&period;
| xref:BloombergLP/bslmt/RecursiveMutex.adoc[`RecursiveMutex`] 
| This `class` implements a recursive mutex (i&period;e&period;, a mutex that can be locked any number of times by a thread, and then released by unlocking the mutex the same number of times)&period; If there is an efficient native recursive mutex, this class wraps it&period; Otherwise, a reasonably efficient proprietary implementation is used&period; Note that `Mutex` should be preferred if at all possible&period;
| xref:BloombergLP/bslmt/RecursiveMutexImpl-0a.adoc[`RecursiveMutexImpl`] 
| Platform&hyphen;specific recursive mutex implementation (forward declaration)&period;
| xref:BloombergLP/bslmt/RecursivemutexImpl-02.adoc[`RecursivemutexImpl`] 
| Platform&hyphen;specific recursive mutex implementation (forward declaration)&period;
| xref:BloombergLP/bslmt/SaturatedTimeConversionImpUtil.adoc[`SaturatedTimeConversionImpUtil`] 
| This `struct` provides a namespace for utility functions that convert time values between different time representations, and &quot;saturate&quot; when values are outside the range of values that may be represented in the destination type (meaning that values above the maximum representable value of the result type are set to the maximum value of the result type, and values below the minimum representable value of the result type are set to the minimum value for the result type)&period;
| xref:BloombergLP/bslmt/Semaphore.adoc[`Semaphore`] 
| This class implements a portable semaphore type for thread synchronization&period; It forwards all requests to an appropriate platform&hyphen;specific implementation&period;
| xref:BloombergLP/bslmt/SemaphoreImpl-0a.adoc[`SemaphoreImpl`] 
| 
| xref:BloombergLP/bslmt/Sluice.adoc[`Sluice`] 
| This class controls the release of threads from a common synchronization point&period; One or more threads may &quot;enter&quot; a `Sluice` object, and then wait to be released&period; Either one waiting thread (via the `signalOne` method), or all waiting threads (via the `signalAll` method), may be signaled for release&period; In any case, `Sluice` provides a guarantee against starvation&period;
| xref:BloombergLP/bslmt/TestUtil.adoc[`TestUtil`] 
| This `struct` provides a namespace for a suite of utility functions that facilitate the creation of BDE&hyphen;style test drivers&period;
| xref:BloombergLP/bslmt/TestUtil_Guard.adoc[`TestUtil&lowbar;Guard`] 
| This `class` defines an object that provides exclusive access to the critical sections defined by this component&apos;s macros&period; Multiple `Guard` objects can exist at once, but only in the same thread &hyphen;&hyphen; if an attempt is made to construct a `Guard` while any `Guard`s exist in other threads, the constructor will block until all `Guard` objects in other threads are destroyed&period; The behavior is undefined if a `Guard` object is anywhere but on the stack&period;
| xref:BloombergLP/bslmt/ThreadAttributes.adoc[`ThreadAttributes`] 
| This simply constrained (value&hyphen;semantic) attribute class characterizes a collection of thread attribute values&period; See the  section for information on the class attributes&period;
| xref:BloombergLP/bslmt/ThreadGroup.adoc[`ThreadGroup`] 
| This class provides a simple mechanism for managing a group of joinable threads&period; The destructor ensures that any running threads are detached so that resources are not leaked&period; This class is thread&hyphen;enabled, thread&hyphen;safe, and exception&hyphen;neutral&period;
| xref:BloombergLP/bslmt/ThreadUtil.adoc[`ThreadUtil`] 
| This `struct` provides a suite of portable utility functions for managing threads&period;
| xref:BloombergLP/bslmt/ThreadUtilImpl-0f.adoc[`ThreadUtilImpl`] 
| Platform&hyphen;specific implementation of `ThreadUtil`&period;
| xref:BloombergLP/bslmt/ThroughputBenchmark.adoc[`ThroughputBenchmark`] 
| This class is a mechanism that provides performance testing for multi&hyphen; threaded components&period; It allows running different thread functions at the same time, and simulates a work load between subsequent calls to the tested thread functions&period; The results are loaded into a `bslmt&colon;&colon;ThroughputBenchmarkResult` object, which provides access to counts of the work done by each thread, thread group, and sample, divided by the number of actual seconds of execution&period;
| xref:BloombergLP/bslmt/ThroughputBenchmarkResult.adoc[`ThroughputBenchmarkResult`] 
| This class provides support for output of multi&hyphen;threaded performance benchmark results&period; The results are counts of work done during the benchmark time period divided by the time period&period;
| xref:BloombergLP/bslmt/ThroughputBenchmarkResult_TestUtil.adoc[`ThroughputBenchmarkResult&lowbar;TestUtil`] 
| This component&hyphen;private class provides modifiable access to the non&hyphen;public attributes of a `ThroughPutBenchmarkResult` object supplied on construction, and is provided for use exclusively in the test driver of this component&period;
| xref:BloombergLP/bslmt/ThroughputBenchmark_TestUtil.adoc[`ThroughputBenchmark&lowbar;TestUtil`] 
| This class implements a test utility that gives the test driver access to the unexposed data members of `ThroughputBenchmark`&period;
| xref:BloombergLP/bslmt/ThroughputBenchmark_WorkData.adoc[`ThroughputBenchmark&lowbar;WorkData`] 
| Data transferred to ThroughputBenchmark&lowbar;WorkFunction&period;
| xref:BloombergLP/bslmt/ThroughputBenchmark_WorkFunction.adoc[`ThroughputBenchmark&lowbar;WorkFunction`] 
| This class is the work function functor, being called for each work thread&period;
| xref:BloombergLP/bslmt/TimedCompletionGuard.adoc[`TimedCompletionGuard`] 
| This class implements a guard for work completion within a specified duration&period;
| xref:BloombergLP/bslmt/TimedSemaphore.adoc[`TimedSemaphore`] 
| This class implements a portable timed semaphore type for thread synchronization&period; It forwards all requests to an appropriate platform&hyphen;specific implementation&period;
| xref:BloombergLP/bslmt/TimedSemaphoreImpl-09.adoc[`TimedSemaphoreImpl`] 
| Forward declaration of platform&hyphen;specific timed semaphore implementation&period;
| xref:BloombergLP/bslmt/TryLockGuard.adoc[`TryLockGuard`] 
| DEPRECATED&colon; Use `LockGuardTryLock` instead&period;
| xref:BloombergLP/bslmt/Turnstile.adoc[`Turnstile`] 
| This class provides a mechanism to meter time&period; Using either the constructor or the `reset` method, the client specifies `rate`, indicating the number of events per second that the turnstile will allow&period; The client then calls `waitTurn`, which will either sleep until the next event is to occur, or return immediately if `waitTurn` was called after the next event is due&period; If `waitTurn` is not called until after the next event is due, the turnstile is said to be `lagging` behind, and calls to `waitTurn` will not sleep until the events have caught up with the schedule&period; Note that calling `waitTurn` a single time does not bring a turnstile back on schedule&period; For example, if a turnstile&apos;s configured frequency is one event per second, and the client is 10 seconds behind schedule, if `waitTurn` were subsequently called once per second, the turnstile will remain at 10 seconds behind schedule&period; The amount by which events are lagging behind the schedule can be determined via the `lagTime` method, which returns the positive number of microseconds by which the turnstile is lagging, or 0 if the turnstile is not behind schedule&period;
| xref:BloombergLP/bslmt/UnLockGuard.adoc[`UnLockGuard`] 
| This class is DEPRECATED&period; Use `LockGuardUnlock` instead&period;
| xref:BloombergLP/bslmt/WriteLockGuard.adoc[`WriteLockGuard`] 
| This class template implements a guard for acquisition and release of write synchronization resources (i&period;e&period;, writer locks)&period;
| xref:BloombergLP/bslmt/WriteLockGuardTryLock.adoc[`WriteLockGuardTryLock`] 
| This class template implements a guard for tentative acquisition and release of write synchronization resources (i&period;e&period;, writer locks)&period;
| xref:BloombergLP/bslmt/WriteLockGuardUnlock.adoc[`WriteLockGuardUnlock`] 
| This class template implements a guard for release and reacquisition of write synchronization resources (i&period;e&period;, writer locks)&period;
|===


== Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/operator_lshift.adoc[`operator&lt;&lt;`] 
| Write the value of the specified `object` object to the specified output `stream` in a single&hyphen;line format, and return a reference to `stream`&period; If `stream` is not valid on entry, this operation has no effect&period; Note that this human&hyphen;readable format is not fully specified, can change without notice, and is logically equivalent to&colon; &grave; print(stream, 0, &hyphen;1)&semi; &grave;
| xref:BloombergLP/bslmt/operator_eq.adoc[`operator&equals;&equals;`] 
| Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise&period; Two `ThreadAttributes` objects have the same value if the corresponding values of their `detachedState`, `guardSize`, `inheritSchedule`, `schedulingPolicy`, `schedulingPriority`, and `stackSize` attributes are the same&period;
| xref:BloombergLP/bslmt/operator_not_eq.adoc[`operator!&equals;`] 
| Return `true` if the specified `lhs` and `rhs` objects do not have the same value, and `false` otherwise&period; Two `baltzo&colon;&colon;LocalTimeDescriptor` objects do not have the same value if the corresponding values of their `detachedState`, `guardSize`, `inheritSchedule`, `schedulingPolicy`, `schedulingPriority`, and `stackSize` attributes are not the same&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
