29#include <sptk5/Exception.h>
30#include <sptk5/sptk.h>
33#include <shared_mutex>
37using SharedMutex = std::shared_timed_mutex;
38using ReadLockType = std::shared_lock<SharedMutex>;
39using WriteLockType = std::unique_lock<SharedMutex>;
67 UniqueLockInt(SharedMutex& mutex, std::chrono::milliseconds timeout,
const char* file,
size_t line);
109 SharedLockInt(SharedMutex& mutex, std::chrono::milliseconds timeout,
const char* file,
size_t line);
121 mutex.unlock_shared();
142 WriteLockType destinationLock;
143 ReadLockType sourceLock;
153 CopyLockInt(SharedMutex& destinationMutex, SharedMutex& sourceMutex);
176#define UniqueLock(amutex) sptk::UniqueLockInt lock(amutex)
177#define TimedUniqueLock(amutex, timeout) sptk::UniqueLockInt lock(amutex, timeout, __FILE__, __LINE__)
178#define SharedLock(amutex) sptk::SharedLockInt lock(amutex)
179#define TimedSharedLock(amutex, timeout) sptk::SharedLockInt lock(amutex, timeout, __FILE__, __LINE__)
180#define CompareLock(mutex1, mutex2) sptk::CompareLockInt lock(mutex1, mutex2)
181#define CopyLock(destinationMutex, sourceMutex) sptk::CopyLockInt lock(destinationMutex, sourceMutex)
CompareLockInt(SharedMutex &lock1, SharedMutex &lock2)
CopyLockInt(SharedMutex &destinationMutex, SharedMutex &sourceMutex)
SharedLockInt(SharedMutex &mutex)
virtual ~SharedLockInt()
Definition: Locks.h:117
SharedLockInt(SharedMutex &mutex, std::chrono::milliseconds timeout, const char *file, size_t line)
virtual ~UniqueLockInt()
Definition: Locks.h:73
UniqueLockInt(SharedMutex &mutex)
UniqueLockInt(SharedMutex &mutex, std::chrono::milliseconds timeout, const char *file, size_t line)