[#BloombergLP-bslmt-ChronoUtil-timedWait-0a]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ChronoUtil.adoc[ChronoUtil]::timedWait
:relfileprefix: ../../../
:mrdocs:

Block on `primitive` with an argument until success or timeout&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class PRIMITIVE,
    class ARG&lowbar;TYPE,
    class CLOCK,
    class DURATION&gt;
static
int
timedWait(
    PRIMITIVE* primitive,
    ARG&lowbar;TYPE* argument,
    bsl::chrono::time&lowbar;point&lt;CLOCK, DURATION&gt; const& absTime);
----

== Description

Block on the specified `primitive` object of the (template parameter) `PRIMITIVE` type by calling its `timedWait` method, passing the specified `argument` of the (template parameter) `ARG&lowbar;TYPE` and a timeout calculated from the specified `absTime`&period; `absTime` is an _absolute_ time represented by a time point with respect to some epoch, which is determined by the clock associated with the time point&period; Return 0 on success, `PRIMITIVE&colon;&colon;e&lowbar;TIMED&lowbar;OUT` if the `absTime` timeout expired, and other return values on error&period; The `timedWait` method of `primitive` is called only once if the clock type specified by the (template parameter) type `CLOCK` corresponds to the clock used by `primitive`, and may be called more than once otherwise&period; Note that error codes returned from this method, necessarily distinct from 0 and `PRIMITIVE&colon;&colon;e&lowbar;TIMED&lowbar;OUT`, are defined by `PRIMITIVE`&period;

== Return Value

0 on success, `PRIMITIVE&colon;&colon;e&lowbar;TIMED&lowbar;OUT` on timeout, and other values on error

== Parameters

[cols="1,4"]
|===
| Name| Description
| *primitive*
| synchronization primitive on which to wait
| *argument*
| additional argument forwarded to `timedWait`
| *absTime*
| absolute timeout as a `bsl&colon;&colon;chrono&colon;&colon;time&lowbar;point`
|===


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