[#BloombergLP-bslmt-TimedCompletionGuard] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::TimedCompletionGuard :relfileprefix: ../../ :mrdocs: This class implements a guard for work completion within a specified duration. == Synopsis Declared in `<bslmt_timedcompletionguard.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class TimedCompletionGuard; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/TimedCompletionGuard/Handler.adoc[`Handler`] | `Handler` is an alias for a pointer to a function returning `void`, and taking, as a parameter, a null‐terminated string, which is the structure of the handler function supported by this class ‐‐ e.g., ` void myHandler(const char *text); ` | xref:BloombergLP/bslmt/TimedCompletionGuard/allocator_type.adoc[`allocator_type`] | Alias indicating this type is allocator‐aware. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/TimedCompletionGuard/2constructor-03.adoc[`TimedCompletionGuard`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslmt/TimedCompletionGuard/2destructor.adoc[`~TimedCompletionGuard`] [.small]#[destructor]# | Invoke `release` and destroy this guard. | xref:BloombergLP/bslmt/TimedCompletionGuard/get_allocator.adoc[`get_allocator`] | Return the allocator used to supply memory. | xref:BloombergLP/bslmt/TimedCompletionGuard/guard.adoc[`guard`] | 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. | xref:BloombergLP/bslmt/TimedCompletionGuard/isGuarding.adoc[`isGuarding`] | Return `true` if this guard is currently configured with a duration to guard, and `false` otherwise. | xref:BloombergLP/bslmt/TimedCompletionGuard/release.adoc[`release`] | If a thread is waiting to alert at expiration of the `set` duration, join the thread, thus preventing any alerting. | xref:BloombergLP/bslmt/TimedCompletionGuard/updateText.adoc[`updateText`] | Use the specified `text` for alerting when the current duration expires. Return 0 on success, and a non‐zero value if `false == isGuarding()`. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/TimedCompletionGuard/failByAbort.adoc[`failByAbort`] [.small]#[noreturn]# | (Default Handler) Emulate the invocation of the standard `assert` macro with a `false` argument, using the expression `text` to generate a helpful output message and then, after logging, unconditionally aborting. Note that this handler function is the default installed assertion handler. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#