Attempts an atomic transition from the from‐lock to the to‐lock, waiting up to the given timeout for the transition to become available.

Synopsis

Declared in <folly/synchronization/Lock.h>

template<
    template<typename> typename ToLock,
    typename Mutex,
    template<typename> typename FromLock,
    typename Rep,
    typename Period>
ToLock<Mutex>
try_transition_lock_for(
    FromLock<Mutex>& lock,
    std::chrono::duration<Rep, Period> const& timeout);

Return Value

A lock holder of the target lock type; empty if the attempt failed.

Parameters

Name

Description

lock

The lock holder to transition from.

timeout

The maximum duration to wait for.

Created with MrDocs