4 #include <samchon/library/Semaphore.hpp> 74 this->reference =
new std::atomic<size_t>(0);
75 this->locked =
new std::atomic<bool>(
false);
99 this->semaphore = obj.semaphore;
100 this->reference = obj.reference;
101 this->locked = obj.locked;
104 obj.semaphore =
nullptr;
105 obj.reference =
nullptr;
106 obj.locked =
nullptr;
114 if (reference ==
nullptr || reference->operator--() > 0)
117 if (locked->load() ==
true)
132 if (locked->load() ==
true)
144 if (locked->load() ==
false)
148 locked->store(
false);
SharedAcquire(const SharedAcquire &obj)
Copy Constructor.
void acquire()
Acquire admission.
void release()
Release an admission.
std::atomic< bool > * locked
Whether the mutex was locked by SharedAcquire.
void acquire()
Acquire admission.
~SharedAcquire()
Default Destructor.
Shared acquire from a Semaphore.
Semaphore * semaphore
Managed Semaphore.
std::atomic< size_t > * reference
Referencing count sharing same Semaphore.
void release()
Release an admission.
SharedAcquire(SharedAcquire &&obj)
Move Constructor.
SharedAcquire(Semaphore &semaphore, bool lock=true)
Construct from Semaphore.