Samchon Framework for CPP  1.0.0
RWMutex.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 namespace std
5 {
6  template <typename T> struct atomic;
7  class condition_variable;
8  class mutex;
9 };
10 namespace samchon
11 {
12 namespace library
13 {
33  class SAMCHON_FRAMEWORK_API RWMutex
34  {
35  private:
36  //Status variables
37  std::atomic<size_t> *readingCount;
38  std::atomic<bool> *isWriting;
39  std::mutex *minusMtx;
40 
41  //Lockers
42  std::condition_variable *cv;
43  std::mutex *readMtx;
44  std::mutex *writeMtx;
45 
46  public:
50  RWMutex();
51  ~RWMutex();
52 
65  void readLock() const;
66 
76  void readUnlock() const;
77 
91  void writeLock();
92 
96  void writeUnlock();
97  };
98 };
99 };
100 
101 #include <samchon/library/UniqueReadLock.hpp>
102 #include <samchon/library/UniqueWriteLock.hpp>
103 
104 #include <samchon/library/SharedReadLock.hpp>
105 #include <samchon/library/SharedWriteLock.hpp>
Definition: RWMutex.hpp:4
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7