ScopedWrite#
Fully qualified name: carb::settings::ScopedWrite
Defined in carb/settings/ISettings.h
-
class ScopedWrite : public carb::dictionary::ScopedWrite#
A helper class for performing a scoped write lock on the settings database.
Public Functions
-
inline ScopedWrite()#
RAII constructor.
Immediately takes a write lock and holds it until *this is destroyed.
Note
Settings locks are recursive.
Warning
If the current thread already owns a read lock (i.e. via ScopedRead), promotion to a write lock necessitates releasing all locks and then waiting for a write lock. This can cause state to change. Always re-evaluate state if this is the case.
- inline ScopedWrite(
- ISettings *settings,
- dictionary::IDictionary *dict,
RAII constructor.
Immediately takes a write lock and holds it until *this is destroyed. This version takes interface pointers for cases where it’s not safe to use getCachedInterface().
Note
Settings locks are recursive.
Warning
If the current thread already owns a read lock (i.e. via ScopedRead), promotion to a write lock necessitates releasing all locks and then waiting for a write lock. This can cause state to change. Always re-evaluate state if this is the case.
- Parameters:
settings – The ISettings interface to lock with.
dict – The carb::dictionary::IDictionary interface to lock with.
-
~ScopedWrite() = default#
Destructor. Releases the write lock.
-
inline ScopedWrite()#