[#BloombergLP-bslmt-Turnstile-waitTurn]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/Turnstile.adoc[Turnstile]::waitTurn
:relfileprefix: ../../../
:mrdocs:

Wait until the next turn may be taken, or return immediately&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64]
waitTurn(bool sleep = true);
----

== Description

Sleep until the next turn may be taken or return immediately if the optionally specified `sleep` is false, this turnstile is lagging behind schedule, or if the calculated sleep duration is less than `minTimeToCallSleep`&period; Return the non&hyphen;negative number of microseconds spent waiting, or if `sleep` is false, the number of microseconds the function would have had to wait&period;

== Return Value

non&hyphen;negative microseconds spent waiting, or if `sleep` is false, the microseconds this function would have waited

== Parameters

[cols="1,4"]
|===
| Name| Description
| *sleep*
| if `false`, do not sleep and report the wait duration
|===


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