class KernelTimeout
Defined at line 42 of file ../../third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h
An optional timeout, with nanosecond granularity.
This is a private low-level API for use by a handful of low-level
components. Higher-level components should build APIs based on
absl::Time and absl::Duration.
Public Methods
void KernelTimeout (absl::Time t)
Construct an absolute timeout that should expire at `t`.
void KernelTimeout (absl::Duration d)
Construct a relative timeout that should expire after `d`.
void KernelTimeout ()
Infinite timeout.
Defined at line 51 of file ../../third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h
struct timespec MakeAbsTimespec ()
Convert to `struct timespec` for interfaces that expect an absolute
timeout. If !has_timeout() or is_relative_timeout(), attempts to convert to
a reasonable absolute timeout, but callers should to test has_timeout() and
is_relative_timeout() and prefer to use a more appropriate interface.
struct timespec MakeRelativeTimespec ()
Convert to `struct timespec` for interfaces that expect a relative
timeout. If !has_timeout() or is_absolute_timeout(), attempts to convert to
a reasonable relative timeout, but callers should to test has_timeout() and
is_absolute_timeout() and prefer to use a more appropriate interface. Since
the return value is a relative duration, it should be recomputed by calling
this method in the case of a spurious wakeup.
struct timespec MakeClockAbsoluteTimespec (clockid_t c)
Convert to `struct timespec` for interfaces that expect an absolute timeout
on a specific clock `c`. This is similar to `MakeAbsTimespec()`, but
callers usually want to use this method with `CLOCK_MONOTONIC` when
relative timeouts are requested, and when the appropriate interface expects
an absolute timeout relative to a specific clock (for example,
pthread_cond_clockwait() or sem_clockwait()). If !has_timeout(), attempts
to convert to a reasonable absolute timeout, but callers should to test
has_timeout() prefer to use a more appropriate interface.
int64_t MakeAbsNanos ()
Convert to unix epoch nanos for interfaces that expect an absolute timeout
in nanoseconds. If !has_timeout() or is_relative_timeout(), attempts to
convert to a reasonable absolute timeout, but callers should to test
has_timeout() and is_relative_timeout() and prefer to use a more
appropriate interface.
DWord InMillisecondsFromNow ()
KernelTimeout Never ()
A more explicit factory for those who prefer it.
Equivalent to `KernelTimeout()`.
Defined at line 55 of file ../../third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h
std::chrono::time_point<std::chrono::system_clock> ToChronoTimePoint ()
Convert to std::chrono::time_point for interfaces that expect an absolute
timeout, like std::condition_variable::wait_until(). If !has_timeout() or
is_relative_timeout(), attempts to convert to a reasonable absolute
timeout, but callers should test has_timeout() and is_relative_timeout()
and prefer to use a more appropriate interface.
std::chrono::nanoseconds ToChronoDuration ()
Convert to std::chrono::time_point for interfaces that expect a relative
timeout, like std::condition_variable::wait_for(). If !has_timeout() or
is_absolute_timeout(), attempts to convert to a reasonable relative
timeout, but callers should test has_timeout() and is_absolute_timeout()
and prefer to use a more appropriate interface. Since the return value is a
relative duration, it should be recomputed by calling this method in the
case of a spurious wakeup.
bool has_timeout ()
Returns true if there is a timeout that will eventually expire.
Returns false if the timeout is infinite.
Defined at line 59 of file ../../third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h
bool is_absolute_timeout ()
If `has_timeout()` is true, returns true if the timeout was provided as an
`absl::Time`. The return value is undefined if `has_timeout()` is false
because all indefinite timeouts are equivalent.
Defined at line 64 of file ../../third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h
bool is_relative_timeout ()
If `has_timeout()` is true, returns true if the timeout was provided as an
`absl::Duration`. The return value is undefined if `has_timeout()` is false
because all indefinite timeouts are equivalent.
Defined at line 69 of file ../../third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h
bool SupportsSteadyClock ()
Returns true if steady (aka monotonic) clocks are supported by the system.
This method exists because go/btm requires synchronized clocks, and
thus requires we use the system (aka walltime) clock.
Defined at line 134 of file ../../third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h