[#BloombergLP-bslmt-TimedCompletionGuard-guard] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/TimedCompletionGuard.adoc[TimedCompletionGuard]::guard :relfileprefix: ../../../ :mrdocs: Schedule a handler invocation after `duration` unless released. == Synopsis Declared in `<bslmt_timedcompletionguard.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int guard( xref:BloombergLP/bsls/TimeInterval.adoc[bsls::TimeInterval] const& duration, std::string_view const& text); ---- == Description Configure a thread to, at the expiration of the specified `duration`, invoke the handler assigned at object creation with the specified `text`, unless the `release` method is invoked or this guard is rescheduled with a subsequent call to `guard`. Return 0 on success, and a non‐zero value if a thread is not available and could not be created. The behavior is undefined unless `duration` is a positive value. == Return Value 0 on success, and a non‐zero value otherwise == Parameters [cols="1,4"] |=== | Name| Description | *duration* | positive interval until the handler may be invoked | *text* | diagnostic text passed to the handler on expiration |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#