Defined in carb/dictionary/IDictionary.h

class ScopedWrite

A helper class for calling writeLock() and unlock().

Similar to std::unique_lock.

Subclassed by carb::settings::ScopedWrite

Public Functions

inline ScopedWrite(const IDictionary &dictionary, Item *item)

RAII constructor.

Immediately takes a write lock until *this is destroyed.


Dictionary locks are recursive.


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.

  • dictionary – A reference to IDictionary.

  • item – The item in the subtree to lock. The root of this item is found and the entire subtree from the root is locked. NOTE: Undefined behavior occurs if item is destroyed before *this is destroyed.

inline ~ScopedWrite()

Destructor. Releases the write lock.