[#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&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;threadutil&period;h&gt;`

[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&hyphen;specific key destructors&period;
| xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[`Handle`] 
| Thread handle type&period; Use this type to refer to a thread in a platform&hyphen;independent way&period;
| xref:BloombergLP/bslmt/ThreadUtil/Id.adoc[`Id`] 
| Thread identifier type &hyphen; distinguished from a `Handle` in that it does not have any resources associated with it, whereas `Handle` may, depending on platform&period;
| xref:BloombergLP/bslmt/ThreadUtil/Imp.adoc[`Imp`] 
| Platform&hyphen;specific implementation type&period;
| xref:BloombergLP/bslmt/ThreadUtil/Key.adoc[`Key`] 
| Thread&hyphen;specific key type, used to refer to thread&hyphen;specific storage&period;
| xref:BloombergLP/bslmt/ThreadUtil/NativeHandle-0a.adoc[`NativeHandle`] 
| Platform&hyphen;specific thread handle type&period;
| xref:BloombergLP/bslmt/ThreadUtil/ThreadFunction.adoc[`ThreadFunction`] 
| Prototype for thread entry&hyphen;point functions&period;
|===


== 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&period;
| xref:BloombergLP/bslmt/ThreadUtil/areEqualId.adoc[`areEqualId`] 
| Return whether the two thread identifiers refer to the same thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/convertToSchedulingPriority.adoc[`convertToSchedulingPriority`] 
| Return a platform scheduling priority for the normalized priority&period;
| xref:BloombergLP/bslmt/ThreadUtil/create-0e78.adoc[`create`] 
| `create` overloads
| xref:BloombergLP/bslmt/ThreadUtil/createKey.adoc[`createKey`] 
| Create a process&hyphen;wide key for thread&hyphen;local storage&period;
| xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0a.adoc[`createWithAllocator`] 
| `createWithAllocator` overloads
| xref:BloombergLP/bslmt/ThreadUtil/deleteKey.adoc[`deleteKey`] 
| Delete the specified process&hyphen;wide thread&hyphen;local key&period;
| xref:BloombergLP/bslmt/ThreadUtil/detach.adoc[`detach`] 
| Detach the thread so its resources are reclaimed on termination&period;
| xref:BloombergLP/bslmt/ThreadUtil/exit.adoc[`exit`] 
| Exit the current thread and return the specified status&period;
| xref:BloombergLP/bslmt/ThreadUtil/getMaxSchedulingPriority.adoc[`getMaxSchedulingPriority`] 
| Return the maximum available scheduling priority for the policy&period;
| xref:BloombergLP/bslmt/ThreadUtil/getMinSchedulingPriority.adoc[`getMinSchedulingPriority`] 
| Return the minimum available scheduling priority for the policy&period;
| xref:BloombergLP/bslmt/ThreadUtil/getSpecific.adoc[`getSpecific`] 
| Return the calling thread&apos;s value associated with the specified key&period;
| xref:BloombergLP/bslmt/ThreadUtil/getThreadName.adoc[`getThreadName`] 
| Load the name of the current thread into the specified string&period;
| xref:BloombergLP/bslmt/ThreadUtil/handleToId.adoc[`handleToId`] 
| Return the unique identifier for the thread with the specified handle&period;
| 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&period;
| xref:BloombergLP/bslmt/ThreadUtil/idAsInt.adoc[`idAsInt`] 
| Return a unique integral identifier for the specified thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/idAsUint64.adoc[`idAsUint64`] 
| Return a unique 64&hyphen;bit integral identifier for the specified thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/invalidHandle.adoc[`invalidHandle`] 
| Return a reference to the non&hyphen;modifiable `Handle` object that is guaranteed never to be a valid thread handle&period;
| xref:BloombergLP/bslmt/ThreadUtil/isEqual.adoc[`isEqual`] 
| Return whether the two thread handles identify the same thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/isEqualId.adoc[`isEqualId`] 
| Return whether the two thread identifiers refer to the same thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/isThreadLimitReached.adoc[`isThreadLimitReached`] 
| Return whether the next thread creation should fail due to the limit&period;
| xref:BloombergLP/bslmt/ThreadUtil/join.adoc[`join`] 
| Wait for the specified thread to terminate and reclaim its resources&period;
| xref:BloombergLP/bslmt/ThreadUtil/microSleep.adoc[`microSleep`] 
| Suspend the current thread for at least the specified duration&period;
| xref:BloombergLP/bslmt/ThreadUtil/nativeHandle-0c.adoc[`nativeHandle`] 
| Return the platform&hyphen;specific native handle for the specified thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/self.adoc[`self`] 
| Return an opaque handle that refers to the current thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/selfId.adoc[`selfId`] 
| Return a unique identifier for the current thread in this process&period;
| xref:BloombergLP/bslmt/ThreadUtil/selfIdAsInt.adoc[`selfIdAsInt`] 
| Return a unique integral identifier for the current thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/selfIdAsUint64.adoc[`selfIdAsUint64`] 
| Return a unique 64&hyphen;bit integral identifier for the current thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/selfKernelIdAsUint64.adoc[`selfKernelIdAsUint64`] 
| Return a unique 64&hyphen;bit identifier for the current kernel thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/setSpecific.adoc[`setSpecific`] 
| Associate the specified value with the key for the calling thread&period;
| xref:BloombergLP/bslmt/ThreadUtil/setThreadLimit.adoc[`setThreadLimit`] 
| Enable a thread&hyphen;creation failure limit for testing&period;
| xref:BloombergLP/bslmt/ThreadUtil/setThreadName.adoc[`setThreadName`] 
| Set the name of the current thread to the specified name&period;
| xref:BloombergLP/bslmt/ThreadUtil/sleep-09.adoc[`sleep`] 
| Suspend the current thread for at least the specified relative time&period;
| 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&period;
|===



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