[#BloombergLP-bslmt-ThreadUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::ThreadUtil :relfileprefix: ../../ :mrdocs: This `struct` provides a suite of portable utility functions for managing threads. == Synopsis Declared in `<bslmt_threadutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct ThreadUtil; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/ThreadUtil/Destructor.adoc[`Destructor`] | Prototype for thread‐specific key destructors. | xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[`Handle`] | Thread handle type. Use this type to refer to a thread in a platform‐independent way. | xref:BloombergLP/bslmt/ThreadUtil/Id.adoc[`Id`] | Thread identifier type ‐ distinguished from a `Handle` in that it does not have any resources associated with it, whereas `Handle` may, depending on platform. | xref:BloombergLP/bslmt/ThreadUtil/Imp.adoc[`Imp`] | Platform‐specific implementation type. | xref:BloombergLP/bslmt/ThreadUtil/Key.adoc[`Key`] | Thread‐specific key type, used to refer to thread‐specific storage. | xref:BloombergLP/bslmt/ThreadUtil/NativeHandle-0a.adoc[`NativeHandle`] | Platform‐specific thread handle type. | xref:BloombergLP/bslmt/ThreadUtil/ThreadFunction.adoc[`ThreadFunction`] | Prototype for thread entry‐point functions. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/ThreadUtil/areEqual.adoc[`areEqual`] | Return whether the two thread handles identify the same thread. | xref:BloombergLP/bslmt/ThreadUtil/areEqualId.adoc[`areEqualId`] | Return whether the two thread identifiers refer to the same thread. | xref:BloombergLP/bslmt/ThreadUtil/convertToSchedulingPriority.adoc[`convertToSchedulingPriority`] | Return a platform scheduling priority for the normalized priority. | xref:BloombergLP/bslmt/ThreadUtil/create-0e78.adoc[`create`] | `create` overloads | xref:BloombergLP/bslmt/ThreadUtil/createKey.adoc[`createKey`] | Create a process‐wide key for thread‐local storage. | xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0a.adoc[`createWithAllocator`] | `createWithAllocator` overloads | xref:BloombergLP/bslmt/ThreadUtil/deleteKey.adoc[`deleteKey`] | Delete the specified process‐wide thread‐local key. | xref:BloombergLP/bslmt/ThreadUtil/detach.adoc[`detach`] | Detach the thread so its resources are reclaimed on termination. | xref:BloombergLP/bslmt/ThreadUtil/exit.adoc[`exit`] | Exit the current thread and return the specified status. | xref:BloombergLP/bslmt/ThreadUtil/getMaxSchedulingPriority.adoc[`getMaxSchedulingPriority`] | Return the maximum available scheduling priority for the policy. | xref:BloombergLP/bslmt/ThreadUtil/getMinSchedulingPriority.adoc[`getMinSchedulingPriority`] | Return the minimum available scheduling priority for the policy. | xref:BloombergLP/bslmt/ThreadUtil/getSpecific.adoc[`getSpecific`] | Return the calling thread's value associated with the specified key. | xref:BloombergLP/bslmt/ThreadUtil/getThreadName.adoc[`getThreadName`] | Load the name of the current thread into the specified string. | xref:BloombergLP/bslmt/ThreadUtil/handleToId.adoc[`handleToId`] | Return the unique identifier for the thread with the specified handle. | xref:BloombergLP/bslmt/ThreadUtil/hardwareConcurrency.adoc[`hardwareConcurrency`] | Return a _hint_ at the number of concurrent threads supported by this platform on success, and 0 otherwise. | xref:BloombergLP/bslmt/ThreadUtil/idAsInt.adoc[`idAsInt`] | Return a unique integral identifier for the specified thread. | xref:BloombergLP/bslmt/ThreadUtil/idAsUint64.adoc[`idAsUint64`] | Return a unique 64‐bit integral identifier for the specified thread. | xref:BloombergLP/bslmt/ThreadUtil/invalidHandle.adoc[`invalidHandle`] | Return a reference to the non‐modifiable `Handle` object that is guaranteed never to be a valid thread handle. | xref:BloombergLP/bslmt/ThreadUtil/isEqual.adoc[`isEqual`] | Return whether the two thread handles identify the same thread. | xref:BloombergLP/bslmt/ThreadUtil/isEqualId.adoc[`isEqualId`] | Return whether the two thread identifiers refer to the same thread. | xref:BloombergLP/bslmt/ThreadUtil/isThreadLimitReached.adoc[`isThreadLimitReached`] | Return whether the next thread creation should fail due to the limit. | xref:BloombergLP/bslmt/ThreadUtil/join.adoc[`join`] | Wait for the specified thread to terminate and reclaim its resources. | xref:BloombergLP/bslmt/ThreadUtil/microSleep.adoc[`microSleep`] | Suspend the current thread for at least the specified duration. | xref:BloombergLP/bslmt/ThreadUtil/nativeHandle-0c.adoc[`nativeHandle`] | Return the platform‐specific native handle for the specified thread. | xref:BloombergLP/bslmt/ThreadUtil/self.adoc[`self`] | Return an opaque handle that refers to the current thread. | xref:BloombergLP/bslmt/ThreadUtil/selfId.adoc[`selfId`] | Return a unique identifier for the current thread in this process. | xref:BloombergLP/bslmt/ThreadUtil/selfIdAsInt.adoc[`selfIdAsInt`] | Return a unique integral identifier for the current thread. | xref:BloombergLP/bslmt/ThreadUtil/selfIdAsUint64.adoc[`selfIdAsUint64`] | Return a unique 64‐bit integral identifier for the current thread. | xref:BloombergLP/bslmt/ThreadUtil/selfKernelIdAsUint64.adoc[`selfKernelIdAsUint64`] | Return a unique 64‐bit identifier for the current kernel thread. | xref:BloombergLP/bslmt/ThreadUtil/setSpecific.adoc[`setSpecific`] | Associate the specified value with the key for the calling thread. | xref:BloombergLP/bslmt/ThreadUtil/setThreadLimit.adoc[`setThreadLimit`] | Enable a thread‐creation failure limit for testing. | xref:BloombergLP/bslmt/ThreadUtil/setThreadName.adoc[`setThreadName`] | Set the name of the current thread to the specified name. | xref:BloombergLP/bslmt/ThreadUtil/sleep-09.adoc[`sleep`] | Suspend the current thread for at least the specified relative time. | xref:BloombergLP/bslmt/ThreadUtil/sleepUntil-0be.adoc[`sleepUntil`] | `sleepUntil` overloads | xref:BloombergLP/bslmt/ThreadUtil/yield.adoc[`yield`] | Yield the processor so another ready thread can run. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#