[#BloombergLP-bslmt] = xref:BloombergLP.adoc[BloombergLP]::bslmt :relfileprefix: ../ :mrdocs: Package namespace for multithreading components. == Types [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/Barrier.adoc[`Barrier`] | This class defines a thread barrier. | xref:BloombergLP/bslmt/ChronoUtil.adoc[`ChronoUtil`] | This `struct` provides a namespace for utility functions that operate on `bsl::chrono` facilities. | xref:BloombergLP/bslmt/Condition.adoc[`Condition`] | This `class` implements a portable inter‐thread signaling primitive. | xref:BloombergLP/bslmt/ConditionImpl-02.adoc[`ConditionImpl`] | Platform‐specific condition variable implementation. | 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`. Specifically, these functions manage the default value of thread stack size and provide access to the platform's native guard size, but may be extended to govern more traits in the future. | xref:BloombergLP/bslmt/EntryPointFunctorAdapter.adoc[`EntryPointFunctorAdapter`] | Hold a copy of an instance of parameterized type, along with the allocator used to manage the copy. `TYPE` shall have a copy constructor, and declare the `bslma::UsesBslmaAllocator` trait if it uses `bslma::Allocator` as an argument to its copy constructor. | xref:BloombergLP/bslmt/EntryPointFunctorAdapterUtil.adoc[`EntryPointFunctorAdapterUtil`] | Utility functions for `EntryPointFunctorAdapter`. | xref:BloombergLP/bslmt/EntryPointFunctorAdapter_Base.adoc[`EntryPointFunctorAdapter_Base`] | This component‐private type provides a non‐templated view of `EntryPointFunctorAdapter` for accessing the invoker function. Do not use outside this component. | xref:BloombergLP/bslmt/FastPostSemaphore.adoc[`FastPostSemaphore`] | This class implements a semaphore type, optimized for `post`, for thread synchronization. | xref:BloombergLP/bslmt/FastPostSemaphoreImpl.adoc[`FastPostSemaphoreImpl`] | This class implements a semaphore type, optimized for `post`, for thread synchronization. | xref:BloombergLP/bslmt/FastPostSemaphoreImplWorkaroundUtil.adoc[`FastPostSemaphoreImplWorkaroundUtil`] | This class provides utility functions for workarounds to system level issues for `FastPostSemaphoreImpl`. | 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. | xref:BloombergLP/bslmt/LockGuard.adoc[`LockGuard`] | This class template implements a guard for acquisition and release of synchronization resources (i.e., locks). | xref:BloombergLP/bslmt/LockGuardTryLock.adoc[`LockGuardTryLock`] | This class template implements a guard for tentative acquisition and release of synchronization resources (i.e., locks). | xref:BloombergLP/bslmt/LockGuardUnlock.adoc[`LockGuardUnlock`] | This class template implements a guard for release and reacquisition of synchronization resources (i.e., locks). | xref:BloombergLP/bslmt/LockReadGuard.adoc[`LockReadGuard`] | DEPRECATED: Use `ReadLockGuard` instead. | xref:BloombergLP/bslmt/LockWriteGuard.adoc[`LockWriteGuard`] | DEPRECATED: Use `WriteLockGuard` instead. | 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. The hold time is defined as the cumulative duration for which the mutex was in the locked state. The wait time is defined as the duration for which threads waited for the mutex. | xref:BloombergLP/bslmt/Mutex.adoc[`Mutex`] | This `class` implements a lightweight, portable wrapper of an OS‐level mutex lock to support intra‐process synchronization. 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`. | xref:BloombergLP/bslmt/MutexImpl-09.adoc[`MutexImpl`] | Primary template for platform‐specific mutex implementations. | xref:BloombergLP/bslmt/Once.adoc[`Once`] | Gate‐keeper class for code that should only execute once per process. This class is a POD‐type and can be statically initialized to the value of the `BSLMT_ONCE_INITIALIZE` macro. For this reason, it does not have any explicitly‐declared constructors or destructor. | xref:BloombergLP/bslmt/OnceGuard.adoc[`OnceGuard`] | Guard class for using `Once` safely. Construct an object of this class before conditionally entering one‐time processing code. Destroy the object when the one‐time code is complete. When used this way, this object will be in an "in‐progress" state during the time that the one‐time code is being executed. | xref:BloombergLP/bslmt/Platform.adoc[`Platform`] | This `struct` provides a namespace for concurrency trait definitions. | xref:BloombergLP/bslmt/QLock.adoc[`QLock`] | An efficient statically‐initializable synchronization primitive that enables serialized access to shared resources. Objects of this class can only be manipulated through the use of a `QLockGuard`. The following idiom is used to initialize objects of type `QLock`: ` QLock mylock = BSLMT_QLOCK_INITIALIZER; ` | xref:BloombergLP/bslmt/QLockGuard.adoc[`QLockGuard`] | This class provides the means to acquire and release the lock on a `QLock` object. Typically, the lock is acquired at construction and released automatically on destruction. This class also provides explicit `lock`, `tryLock`, and `unlock` primitives. | xref:BloombergLP/bslmt/QLock_EventFlag.adoc[`QLock_EventFlag`] | [*PRIVATE*]This class provides a thread‐safe mechanism for one thread to inform another thread that some event has occurred. 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). A flag is intended to be used by only two threads: 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. | xref:BloombergLP/bslmt/RWMutex.adoc[`RWMutex`] | This class is a platform‐independent interface to a reader‐writer lock ("RW mutex"). Multiple readers can safely hold the lock simultaneously, whereas only one writer is allowed to hold the lock at a time. This class uses the most efficient RW mutex implementation available for the current platform. Note that the implementation may allow readers to starve writers. | xref:BloombergLP/bslmt/RWMutexImpl-0d.adoc[`RWMutexImpl`] | Platform‐specific implementation of a readers‐writer mutex. | xref:BloombergLP/bslmt/ReadLockGuard.adoc[`ReadLockGuard`] | This class template implements a guard for acquisition and release of read synchronization resources (i.e., reader locks). | xref:BloombergLP/bslmt/ReadLockGuardTryLock.adoc[`ReadLockGuardTryLock`] | This class template implements a guard for tentative acquisition and release of read synchronization resources (i.e., reader locks). | xref:BloombergLP/bslmt/ReadLockGuardUnlock.adoc[`ReadLockGuardUnlock`] | This class template implements a guard for release and reacquisition of read synchronization resources (i.e., reader locks). | xref:BloombergLP/bslmt/ReaderWriterLock.adoc[`ReaderWriterLock`] | This class provides a multi‐reader/single‐writer lock mechanism. | xref:BloombergLP/bslmt/ReaderWriterMutex.adoc[`ReaderWriterMutex`] | This class provides a multi‐reader/single‐writer lock mechanism. | xref:BloombergLP/bslmt/ReaderWriterMutexImpl.adoc[`ReaderWriterMutexImpl`] | This class provides a multi‐reader/single‐writer lock mechanism. | xref:BloombergLP/bslmt/RecursiveMutex.adoc[`RecursiveMutex`] | This `class` implements a recursive mutex (i.e., 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). If there is an efficient native recursive mutex, this class wraps it. Otherwise, a reasonably efficient proprietary implementation is used. Note that `Mutex` should be preferred if at all possible. | xref:BloombergLP/bslmt/RecursiveMutexImpl-0a.adoc[`RecursiveMutexImpl`] | Platform‐specific recursive mutex implementation (forward declaration). | xref:BloombergLP/bslmt/RecursivemutexImpl-02.adoc[`RecursivemutexImpl`] | Platform‐specific recursive mutex implementation (forward declaration). | xref:BloombergLP/bslmt/SaturatedTimeConversionImpUtil.adoc[`SaturatedTimeConversionImpUtil`] | This `struct` provides a namespace for utility functions that convert time values between different time representations, and "saturate" 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). | xref:BloombergLP/bslmt/Semaphore.adoc[`Semaphore`] | This class implements a portable semaphore type for thread synchronization. It forwards all requests to an appropriate platform‐specific implementation. | 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. One or more threads may "enter" a `Sluice` object, and then wait to be released. Either one waiting thread (via the `signalOne` method), or all waiting threads (via the `signalAll` method), may be signaled for release. In any case, `Sluice` provides a guarantee against starvation. | xref:BloombergLP/bslmt/TestUtil.adoc[`TestUtil`] | This `struct` provides a namespace for a suite of utility functions that facilitate the creation of BDE‐style test drivers. | xref:BloombergLP/bslmt/TestUtil_Guard.adoc[`TestUtil_Guard`] | This `class` defines an object that provides exclusive access to the critical sections defined by this component's macros. Multiple `Guard` objects can exist at once, but only in the same thread ‐‐ 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. The behavior is undefined if a `Guard` object is anywhere but on the stack. | xref:BloombergLP/bslmt/ThreadAttributes.adoc[`ThreadAttributes`] | This simply constrained (value‐semantic) attribute class characterizes a collection of thread attribute values. See the section for information on the class attributes. | xref:BloombergLP/bslmt/ThreadGroup.adoc[`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. | xref:BloombergLP/bslmt/ThreadUtil.adoc[`ThreadUtil`] | This `struct` provides a suite of portable utility functions for managing threads. | xref:BloombergLP/bslmt/ThreadUtilImpl-0f.adoc[`ThreadUtilImpl`] | Platform‐specific implementation of `ThreadUtil`. | xref:BloombergLP/bslmt/ThroughputBenchmark.adoc[`ThroughputBenchmark`] | This class is a mechanism that provides performance testing for multi‐ threaded components. It allows running different thread functions at the same time, and simulates a work load between subsequent calls to the tested thread functions. The results are loaded into a `bslmt::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. | xref:BloombergLP/bslmt/ThroughputBenchmarkResult.adoc[`ThroughputBenchmarkResult`] | This class provides support for output of multi‐threaded performance benchmark results. The results are counts of work done during the benchmark time period divided by the time period. | xref:BloombergLP/bslmt/ThroughputBenchmarkResult_TestUtil.adoc[`ThroughputBenchmarkResult_TestUtil`] | This component‐private class provides modifiable access to the non‐public attributes of a `ThroughPutBenchmarkResult` object supplied on construction, and is provided for use exclusively in the test driver of this component. | xref:BloombergLP/bslmt/ThroughputBenchmark_TestUtil.adoc[`ThroughputBenchmark_TestUtil`] | This class implements a test utility that gives the test driver access to the unexposed data members of `ThroughputBenchmark`. | xref:BloombergLP/bslmt/ThroughputBenchmark_WorkData.adoc[`ThroughputBenchmark_WorkData`] | Data transferred to ThroughputBenchmark_WorkFunction. | xref:BloombergLP/bslmt/ThroughputBenchmark_WorkFunction.adoc[`ThroughputBenchmark_WorkFunction`] | This class is the work function functor, being called for each work thread. | xref:BloombergLP/bslmt/TimedCompletionGuard.adoc[`TimedCompletionGuard`] | This class implements a guard for work completion within a specified duration. | xref:BloombergLP/bslmt/TimedSemaphore.adoc[`TimedSemaphore`] | This class implements a portable timed semaphore type for thread synchronization. It forwards all requests to an appropriate platform‐specific implementation. | xref:BloombergLP/bslmt/TimedSemaphoreImpl-09.adoc[`TimedSemaphoreImpl`] | Forward declaration of platform‐specific timed semaphore implementation. | xref:BloombergLP/bslmt/TryLockGuard.adoc[`TryLockGuard`] | DEPRECATED: Use `LockGuardTryLock` instead. | xref:BloombergLP/bslmt/Turnstile.adoc[`Turnstile`] | This class provides a mechanism to meter time. Using either the constructor or the `reset` method, the client specifies `rate`, indicating the number of events per second that the turnstile will allow. 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. 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. Note that calling `waitTurn` a single time does not bring a turnstile back on schedule. For example, if a turnstile'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. 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. | xref:BloombergLP/bslmt/UnLockGuard.adoc[`UnLockGuard`] | This class is DEPRECATED. Use `LockGuardUnlock` instead. | xref:BloombergLP/bslmt/WriteLockGuard.adoc[`WriteLockGuard`] | This class template implements a guard for acquisition and release of write synchronization resources (i.e., writer locks). | xref:BloombergLP/bslmt/WriteLockGuardTryLock.adoc[`WriteLockGuardTryLock`] | This class template implements a guard for tentative acquisition and release of write synchronization resources (i.e., writer locks). | xref:BloombergLP/bslmt/WriteLockGuardUnlock.adoc[`WriteLockGuardUnlock`] | This class template implements a guard for release and reacquisition of write synchronization resources (i.e., writer locks). |=== == Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/operator_lshift.adoc[`operator<<`] | Write the value of the specified `object` object to the specified output `stream` in a single‐line format, and return a reference to `stream`. If `stream` is not valid on entry, this operation has no effect. Note that this human‐readable format is not fully specified, can change without notice, and is logically equivalent to: ` print(stream, 0, ‐1); ` | xref:BloombergLP/bslmt/operator_eq.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise. Two `ThreadAttributes` objects have the same value if the corresponding values of their `detachedState`, `guardSize`, `inheritSchedule`, `schedulingPolicy`, `schedulingPriority`, and `stackSize` attributes are the same. | xref:BloombergLP/bslmt/operator_not_eq.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` objects do not have the same value, and `false` otherwise. Two `baltzo::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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#