Samchon Framework for CPP  1.0.0
SharedAcquire.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 namespace std
5 {
6  template <typename T>
7  struct atomic;
8 };
9 namespace samchon
10 {
11 namespace library
12 {
13  class Semaphore;
14 
51  class SAMCHON_FRAMEWORK_API SharedAcquire
52  {
53  private:
58 
62  std::atomic<size_t> *reference;
63 
67  std::atomic<bool> *isLocked;
68 
69  public:
70  /* -----------------------------------------------------------
71  CONSTRUCTORS
72  ----------------------------------------------------------- */
79  SharedAcquire(Semaphore &, bool = true);
80 
85 
90 
94  ~SharedAcquire();
95 
96  /* -----------------------------------------------------------
97  LOCKERS
98  ----------------------------------------------------------- */
102  void acquire();
103 
107  void release();
108 
112  //auto tryAcquire() -> bool;
113  };
114 };
115 };
Definition: RWMutex.hpp:4
Shared acquire from a Semaphore.
Semaphore * semaphore
Managed Semaphore.
std::atomic< bool > * isLocked
Whether the mutex was locked by SharedAcquire.
std::atomic< size_t > * reference
Referencing count sharing same Semaphore.
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7