folly::coro::SharedLock

This type mirrors the interface of std::shared_lock as much as possible.

Synopsis

Declared in <folly/coro/SharedLock.h>

template<typename Mutex>
class SharedLock
    : public /* implementation-defined */

Description

The main difference between this type and std::shared_lock is that this type is designed to be used with asynchronous shared-mutex types where the lock acquisition is an asynchronous operation.

TODO: Actually implement the .co_lock() method on this class.

Workaround for now is to use: SharedLock<SharedMutex> lock{mutex, std::defer_lock}; ... lock = co_await lock.mutex()->co_scoped_lock_shared();

Base Classes

NameDescription
/* implementation-defined */

Member Functions

NameDescription
operator= Assignment operators
mutex
owns_lock
release
swap
try_lock
unlock
operator bool Conversion to bool

Using Declarations

Name
Unnamed using

Protected Data Members

Name
locked_
mutex_

Deduction Guides

NameDescription
SharedLock<Mutex> Deduces the mutex type of a SharedLock from its constructor arguments.