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

Detach the thread so its resources are reclaimed on termination&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
detach(xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[Handle]& handle);
----

== Description

&quot;Detach&quot; the thread identified by the specified `handle` such that when it terminates, the resources associated with that thread will automatically be reclaimed&period; The behavior is undefined unless `handle` was obtained by a call to `create` or `self`&period; Note that once a thread is &quot;detached&quot;, it is no longer possible to `join` the thread to retrieve its exit status&period;

== Return Value

0 on success, and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *handle*
| thread to detach
|===


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