23 #ifndef ETCPAL_CPP_RWLOCK_H_
24 #define ETCPAL_CPP_RWLOCK_H_
28 #include "etcpal/rwlock.h"
269 inline void ReadGuard::GetReadLock()
272 ETCPAL_THROW(std::runtime_error(
"etcpal_rwlock_readlock failed."));
328 inline void WriteGuard::GetWriteLock()
331 ETCPAL_THROW(std::runtime_error(
"etcpal_rwlock_writelock failed."));
Read lock guard around a read-write lock.
Definition: rwlock.h:232
ReadGuard(RwLock &rwlock)
Lock an etcpal::RwLock for reading.
Definition: rwlock.h:251
~ReadGuard()
Release the read lock upon going out-of-scope.
Definition: rwlock.h:264
A wrapper class for the EtcPal read-write lock type.
Definition: rwlock.h:112
bool WriteLock()
Access the read-write lock for writing.
Definition: rwlock.h:181
etcpal_rwlock_t & get()
Get a reference to the underlying etcpal_rwlock_t type.
Definition: rwlock.h:211
void ReadUnlock()
Release a read lock on the read-write lock.
Definition: rwlock.h:174
~RwLock()
Destroy the read-write lock.
Definition: rwlock.h:143
void WriteUnlock()
Release a write lock on the read-write lock.
Definition: rwlock.h:205
bool TryReadLock(int timeout_ms=0)
Try to access the read-write lock for reading.
Definition: rwlock.h:166
RwLock()
Create a new read-write lock.
Definition: rwlock.h:137
bool TryWriteLock(int timeout_ms=0)
Try to access the read-write lock for writing.
Definition: rwlock.h:197
bool ReadLock()
Access the read-write lock for reading.
Definition: rwlock.h:150
Write lock guard around a read-write lock.
Definition: rwlock.h:291
WriteGuard(RwLock &rwlock)
Lock an etcpal::RwLock for writing.
Definition: rwlock.h:310
~WriteGuard()
Release the write lock upon going out-of-scope.
Definition: rwlock.h:323
Common definitions used by EtcPal C++ wrappers.
bool etcpal_rwlock_timed_writelock(etcpal_rwlock_t *id, int timeout_ms)
Try to access a read-write lock for writing, giving up after a timeout.
void etcpal_rwlock_destroy(etcpal_rwlock_t *id)
Destroy a read-write lock object.
void etcpal_rwlock_readunlock(etcpal_rwlock_t *id)
Release a read lock on a read-write lock object.
PLATFORM_DEFINED etcpal_rwlock_t
The read-write lock identifier.
Definition: rwlock.dox:79
bool etcpal_rwlock_create(etcpal_rwlock_t *id)
Create a new read-write lock.
void etcpal_rwlock_writeunlock(etcpal_rwlock_t *id)
Release a write lock on a read-write lock object.
bool etcpal_rwlock_readlock(etcpal_rwlock_t *id)
Access a read-write lock for reading.
bool etcpal_rwlock_writelock(etcpal_rwlock_t *id)
Access a read-write lock for writing.
bool etcpal_rwlock_timed_readlock(etcpal_rwlock_t *id, int timeout_ms)
Try to access a read-write lock for reading, giving up after a timeout.