carb::dictionary::ScopedRead

Defined in carb/dictionary/IDictionary.h

class ScopedRead

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

Similar to std::shared_lock.

Subclassed by carb::settings::ScopedRead

Public Functions

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

RAII constructor.

Immediately takes a read lock until *this is destroyed.

Note

Dictionary locks are recursive.

Parameters
  • 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 ~ScopedRead()

Destructor. Releases the read lock.