9 #ifndef CPPCOMMON_THREADS_NAMED_MUTEX_H
10 #define CPPCOMMON_THREADS_NAMED_MUTEX_H
45 const std::string&
name()
const;
88 Impl& impl() noexcept {
return reinterpret_cast<Impl&
>(_storage); }
89 const Impl& impl() const noexcept {
return reinterpret_cast<Impl const&
>(_storage); }
91 static const size_t StorageSize = 136;
92 static const size_t StorageAlign = 8;
93 alignas(StorageAlign) std::byte _storage[StorageSize];
Named mutex synchronization primitive.
NamedMutex(const std::string &name)
Default class constructor.
bool TryLock()
Try to acquire mutex without block.
void Unlock()
Release mutex.
NamedMutex & operator=(const NamedMutex &)=delete
const std::string & name() const
Get the mutex name.
void Lock()
Acquire mutex with block.
NamedMutex(NamedMutex &&mutex)=delete
NamedMutex & operator=(NamedMutex &&mutex)=delete
NamedMutex(const NamedMutex &)=delete
bool TryLockUntil(const UtcTimestamp ×tamp)
Try to acquire mutex until the given timestamp.
bool TryLockFor(const Timespan ×pan)
Try to acquire mutex for the given timespan.
Locker synchronization primitive definition.
C++ Common project definitions.