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

Wait for the specified thread to terminate and reclaim its resources&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
join(
    xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[Handle]& threadHandle,
    void** status = 0);
----

== Description

Suspend execution of the current thread until the thread referred to by the specified `threadHandle` terminates, and reclaim any system resources associated with `threadHandle`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; If the optionally specified `status` is not 0, load into `&ast;status` the value returned by the function supplied at the creation of the thread identified by `threadHandle`&period; The behavior is undefined unless `threadHandle` was obtained by a call to `create`&period;

== Return Value

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *threadHandle*
| thread to wait for
| *status*
| if non&hyphen;null, receives the thread&apos;s exit status
|===


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