BloombergLP::bslmt::ThreadUtilImpl<Platform::PosixThreads>::sleep

Suspend the current thread for at least the specified relative time.

Synopsis

Declared in <bslmt_threadutilimpl_pthread.h>

static
int
sleep(
    bsls::TimeInterval const& sleepTime,
    bsls::TimeInterval* unsleptTime = 0);

Description

Suspend execution of the current thread for a period of at least the specified sleepTime (relative time), and optionally load into the optionally specified unsleptTime the amount of time that was not slept by this function if the operation was interrupted by a signal. Return 0 on success, and a non-zero value if the operation was interrupted by a signal. Note that the actual time suspended depends on many factors including system scheduling, and system timer resolution.

Return Value

0 on success, and a non-zero value if interrupted by a signal

Parameters

NameDescription
sleepTimeminimum relative duration to sleep
unsleptTimeif non-null, receives any remaining unslept time