std::shared_mutex replacement for asynchronous tasks
More...
#include <userver/engine/shared_mutex.hpp>
|
| SharedMutex (const SharedMutex &)=delete |
|
| SharedMutex (SharedMutex &&)=delete |
|
SharedMutex & | operator= (const SharedMutex &)=delete |
|
SharedMutex & | operator= (SharedMutex &&)=delete |
|
void | lock () |
|
void | unlock () |
|
bool | try_lock () |
|
template<typename Rep , typename Period > |
bool | try_lock_for (const std::chrono::duration< Rep, Period > &) |
|
template<typename Clock , typename Duration > |
bool | try_lock_until (const std::chrono::time_point< Clock, Duration > &) |
|
bool | try_lock_until (Deadline deadline) |
|
void | lock_shared () |
|
void | unlock_shared () |
|
bool | try_lock_shared () |
|
template<typename Rep , typename Period > |
bool | try_lock_shared_for (const std::chrono::duration< Rep, Period > &) |
|
template<typename Clock , typename Duration > |
bool | try_lock_shared_until (const std::chrono::time_point< Clock, Duration > &) |
|
bool | try_lock_shared_until (Deadline deadline) |
|
std::shared_mutex replacement for asynchronous tasks
Example usage:
constexpr auto kTestString = "123";
std::string data;
{
std::lock_guard<engine::SharedMutex> lock(mutex);
data = kTestString;
}
{
std::shared_lock<engine::SharedMutex> lock(mutex);
const auto& x = data;
ASSERT_EQ(x, kTestString);
}
- See also
- Synchronization Primitives
Definition at line 23 of file shared_mutex.hpp.
◆ try_lock_for()
template<typename Rep , typename Period >
bool engine::SharedMutex::try_lock_for |
( |
const std::chrono::duration< Rep, Period > & |
duration | ) |
|
◆ try_lock_shared_for()
template<typename Rep , typename Period >
bool engine::SharedMutex::try_lock_shared_for |
( |
const std::chrono::duration< Rep, Period > & |
duration | ) |
|
◆ try_lock_shared_until()
template<typename Clock , typename Duration >
bool engine::SharedMutex::try_lock_shared_until |
( |
const std::chrono::time_point< Clock, Duration > & |
until | ) |
|
◆ try_lock_until()
template<typename Clock , typename Duration >
bool engine::SharedMutex::try_lock_until |
( |
const std::chrono::time_point< Clock, Duration > & |
until | ) |
|
The documentation for this class was generated from the following file: