5 #include <libutl/host_thread.h> 6 #include <libutl/NamedObjectMI.h> 42 bool haveWriteLock()
const;
51 (mode ==
io_rd) ? rdlock() : wrlock();
70 return (mode ==
io_rd) ? tryrdlock() : trywrlock();
96 return _writeLockOwner.load(std::memory_order_relaxed);
100 char pad1[UTL_CACHE_LINE_SIZE -
sizeof(
void*)];
101 std::atomic<thread_handle_t> _writeLockOwner;
103 char pad2[UTL_CACHE_LINE_SIZE -
sizeof(size_t)];
104 std::atomic_size_t _numActive;
105 char pad3[UTL_CACHE_LINE_SIZE -
sizeof(size_t)];
169 (mode ==
io_rd) ? rdlock() : wrlock();
223 return _trylock(mode);
234 return (mode ==
io_rd) ? tryrdlock() : trywrlock();
289 if (_locked) _unlock();
296 (mode ==
io_rd) ? _rdlock() : _wrlock();
320 return (mode ==
io_rd) ? _tryrdlock() : _trywrlock();
328 if (_rwlock->tryrdlock()) _locked =
true;
337 if (_rwlock->trywrlock()) _locked =
true;
void deInit()
De-initialize UTL++.
void lock(uint_t mode)
Acquire read- or write-lock.
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
void lock(uint_t mode)
Acquire read- or write-lock.
Acquire/release a RWlockLF RAII-style.
void wrlock()
Acquire write-lock.
RWlockLFguard()
Default constructor.
bool trywrlock(RWlockLF *rwlock)
Try to acquire write-lock (without blocking).
void lock(RWlockLF *rwlock, uint_t mode)
Acquire read- or write-lock.
bool trywrlock()
Try to acquire write-lock (without blocking).
~RWlockLFguard()
Destructor.
bool trylock(RWlockLF *rwlock, uint_t mode)
Try to acquire read- or write-lock (without blocking).
RWlockLFguard(RWlockLF *rwlock, uint_t mode)
Constructor.
Read/write lock (lock-free implementation).
unsigned int uint_t
Unsigned integer.
void rdlock()
Acquire read-lock.
void wrlock(RWlockLF *rwlock)
Acquire write-lock.
bool tryrdlock(RWlockLF *rwlock)
Try to acquire read-lock (without blocking).
bool tryrdlock()
Try to acquire read-lock (without blocking).
bool trylock(uint_t mode)
Try to acquire read- or write-lock (without blocking).
#define UTL_CLASS_NO_COPY
Declare that a class cannot do copy().
void unlock()
Release the lock.
Root of UTL++ class hierarchy.
bool trylock(uint_t mode)
Try to acquire read- or write-lock (without blocking).
void init()
Initialize UTL++.
#define ASSERTD
Do an assertion in DEBUG mode only.
void rdlock(RWlockLF *rwlock)
Acquire read-lock.