[#BloombergLP-bslmt-ThreadUtilImpl-04-sleep]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThreadUtilImpl-04.adoc[ThreadUtilImpl&lt;Platform::PosixThreads&gt;]::sleep
:relfileprefix: ../../../
:mrdocs:

Suspend the current thread for at least the specified relative time&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;threadutilimpl&lowbar;pthread&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
sleep(
    xref:BloombergLP/bsls/TimeInterval.adoc[bsls::TimeInterval] const& sleepTime,
    xref:BloombergLP/bsls/TimeInterval.adoc[bsls::TimeInterval]* unsleptTime = 0);
----

== Description

Suspend execution of the current thread for a period of at least the specified `sleepTime` (relative time), and optionally load into the optionally specified `unsleptTime` the amount of time that was not slept by this function if the operation was interrupted by a signal&period; Return 0 on success, and a non&hyphen;zero value if the operation was interrupted by a signal&period; Note that the actual time suspended depends on many factors including system scheduling, and system timer resolution&period;

== Return Value

0 on success, and a non&hyphen;zero value if interrupted by a signal

== Parameters

[cols="1,4"]
|===
| Name| Description
| *sleepTime*
| minimum relative duration to sleep
| *unsleptTime*
| if non&hyphen;null, receives any remaining unslept time
|===


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