template<typename T, typename RcuTraits>
class rcu::WritablePtr< T, RcuTraits >
Smart pointer for rcu::Variable<T> for changing RCU value. It stores a reference to a to-be-changed value and allows one to mutate the value (e.g. add items to std::unordered_map). Changed value is not visible to readers until explicit store by Commit.
Only a single writer may own a WritablePtr associated with the same Variable. With regular mutex traits, the writer mutex serializes concurrent write transactions and is held until Commit or WritablePtr destruction. StartWrite acquires the mutex and then copies the latest committed value into the transaction. In-place write APIs acquire the mutex before constructing the internal replacement value. This critical section doesn't affect readers, so a slow writer doesn't block readers.
- Note
- you may not pass WritablePtr between coroutines as it owns engine::Mutex, which must be unlocked in the same coroutine that was used to lock the mutex.
Definition at line 324 of file rcu.hpp.