ADTF  3.18.3
shared_mutex.h
Go to the documentation of this file.
1 
15 #ifndef A_UTIL_UTIL_CONCURRENCY_SHARED_MUTEX_HEADER_INCLUDED
16 #define A_UTIL_UTIL_CONCURRENCY_SHARED_MUTEX_HEADER_INCLUDED
17 
18 #include <memory>
19 
20 namespace a_util {
21 namespace concurrency {
26 class shared_mutex {
27  shared_mutex(const shared_mutex&); // = delete;
28  shared_mutex& operator=(const shared_mutex&); // = delete;
29 
30  struct impl;
31  std::unique_ptr<impl> p;
32 
33 public:
36 
39 
41  void lock();
42 
47  bool try_lock();
48 
50  void unlock();
51 
53  void lock_shared();
54 
60 
62  void unlock_shared();
63 };
64 
65 } // namespace concurrency
66 } // namespace a_util
67 
68 #endif // A_UTIL_UTIL_CONCURRENCY_SHARED_MUTEX_HEADER_INCLUDED
A shared_mutex class as a workaround for std::shared_timed_mutex.
Definition: shared_mutex.h:26
bool try_lock_shared()
Try to lock the mutex for shared ownership.
~shared_mutex()
DTOR - does not call unlock!
void unlock_shared()
Unlock the mutex (shared ownership)
void lock_shared()
Lock the mutex for shared ownership, blocks if the mutex is not available.
shared_mutex()
CTOR - creates the mutex in an unlocked state.
void unlock()
Unlock the mutex.
bool try_lock()
Try to lock the mutex.
void lock()
Lock the mutex, blocks if the mutex is not available.
Serves as the root component, with common functionality documented in core functionality.
Definition: base.h:24