Attempts to dequeue an element, waiting for at most the given duration.

Synopses

Declared in <folly/concurrency/UnboundedQueue.h>

Attempts to dequeue an element, waiting for at most the given duration.

template<
    typename Rep,
    typename Period>
folly::Optional<T>
try_dequeue_for(std::chrono::duration<Rep, Period> const& duration) noexcept;

Attempts to dequeue an element, waiting for at most the given duration.

template<
    typename Rep,
    typename Period>
bool
try_dequeue_for(
    T& item,
    std::chrono::duration<Rep, Period> const& duration) noexcept;

Return Value

  • The dequeued element, or an empty optional on timeout.

  • True if an element was dequeued, false on timeout.

Parameters

Name

Description

duration

The maximum time to wait.

item

Receives the dequeued element on success.

Created with MrDocs