folly::lock

lock overloads

Synopses

Declared in <folly/Synchronized.h>

Make an exclusive locking helper.

template<
    typename D,
    typename M,
    typename... Args>
auto
lock(
    Synchronized<D, M>& synchronized,
    Args&&... args);
» more...

Make an exclusive locking helper for a const object.

template<
    typename D,
    typename M,
    typename... Args>
auto
lock(
    Synchronized<D, M> const& synchronized,
    Args&&... args);
» more...

Acquire locks on many lockables or synchronized instances in such a way that the sequence of calls within the function does not cause deadlocks.

template<
    typename LockableOne,
    typename LockableTwo,
    typename... Lockables>
void
lock(
    LockableOne& one,
    LockableTwo& two,
    Lockables&... lockables);
» more...

Return Value

A locking helper for use with lock() or synchronized().

Parameters

NameDescription
synchronizedThe object to lock.
argsExtra arguments forwarded to the locking function.
oneThe first lockable to acquire.
twoThe second lockable to acquire.
lockablesAny additional lockables to acquire.