Schedule a handler invocation after duration unless released.

Synopsis

Declared in <bslmt_timedcompletionguard.h>

int
guard(
    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

Name

Description

duration

positive interval until the handler may be invoked

text

diagnostic text passed to the handler on expiration

Created with MrDocs