#include <userver/concurrent/variable.hpp>
Container for shared data protected with a mutex of any type (mutex, shared mutex, etc.).
Definition at line 58 of file variable.hpp.
Public Member Functions | |
template<typename... Arg> | |
Variable (Arg &&... arg) | |
LockedPtr< std::unique_lock< Mutex >, Data > | UniqueLock () |
LockedPtr< std::unique_lock< Mutex >, const Data > | UniqueLock () const |
std::optional< LockedPtr< std::unique_lock< Mutex >, const Data > > | UniqueLock (std::try_to_lock_t) const |
std::optional< LockedPtr< std::unique_lock< Mutex >, Data > > | UniqueLock (std::try_to_lock_t) |
std::optional< LockedPtr< std::unique_lock< Mutex >, const Data > > | UniqueLock (std::chrono::milliseconds try_duration) const |
std::optional< LockedPtr< std::unique_lock< Mutex >, Data > > | UniqueLock (std::chrono::milliseconds try_duration) |
LockedPtr< std::shared_lock< Mutex >, const Data > | SharedLock () const |
LockedPtr< std::shared_lock< Mutex >, Data > | SharedMutableLockUnsafe () |
LockedPtr< std::lock_guard< Mutex >, Data > | Lock () |
LockedPtr< std::lock_guard< Mutex >, const Data > | Lock () const |
Mutex & | GetMutexUnsafe () const |
Data & | GetDataUnsafe () |
const Data & | GetDataUnsafe () const |
|
inline |
Definition at line 61 of file variable.hpp.
|
inline |
Get raw data. Use with extreme caution, only for cases where it is impossible to access data with safe methods (e.g. std::scoped_lock with multiple mutexes). For simple use cases call Lock(), UniqueLock(), SharedLock() instead.
Definition at line 102 of file variable.hpp.
|
inline |
Definition at line 104 of file variable.hpp.
|
inline |
Get raw mutex. Use with caution. For simple use cases call Lock(), UniqueLock(), SharedLock() instead.
Definition at line 96 of file variable.hpp.
|
inline |
Definition at line 90 of file variable.hpp.
|
inline |
Definition at line 92 of file variable.hpp.
|
inline |
Definition at line 84 of file variable.hpp.
|
inline |
Useful for grabbing a reference to an object in a node-based container, e.g. std::unordered_map
. Values must support concurrent modification.
Definition at line 88 of file variable.hpp.
|
inline |
Definition at line 63 of file variable.hpp.
|
inline |
Definition at line 65 of file variable.hpp.
|
inline |
Definition at line 80 of file variable.hpp.
|
inline |
Definition at line 75 of file variable.hpp.
|
inline |
Definition at line 71 of file variable.hpp.
|
inline |
Definition at line 67 of file variable.hpp.