refs #495 Using LockFree to make CCached::get() threadsafe.

This commit is contained in:
Mathew Sutcliffe
2015-10-18 21:53:32 +01:00
parent 0dec51beb6
commit 21d61e1def
3 changed files with 13 additions and 12 deletions

View File

@@ -156,7 +156,8 @@ namespace BlackMisc
m_element(m_page.createElement(key, qMetaTypeId<T>(), wrap(validator), CVariant::from(defaultValue), slot_cast(slot)))
{}
//! Read the current value. Must be called from the thread in which the owner lives.
//! Read the current value.
//! \threadsafe
const T &get() const { static const T empty {}; return *(isValid() ? static_cast<const T *>(getVariant().data()) : &empty); }
//! Write a new value. Must be called from the thread in which the owner lives.