#include <userver/utils/swappingsmart.hpp>
Deprecated RCU-like shared_ptr cell with swap-based updates for readers.
Use a faster and more reliable rcu::Variable instead of this class!
This class helps to store pointer. Pointer stored as shared_ptr. Whet you call Get, you will get copy of this shared pointer under read lock. When you call Set pointer, it will be stored under writelock.
It works slower than SwappingPtr in 5 times, but readers will always have shared_ptr that they obtained, so it is impossible that data will be free'd.
Definition at line 25 of file swappingsmart.hpp.
Public Member Functions | |
| SwappingSmart (const std::shared_ptr< T > &ptr) | |
| std::shared_ptr< T > | Get () const |
| void | Set (const std::shared_ptr< T > &ptr) |
| void | Set (T &&obj) |
| void | Clear () |
|
inlineexplicit |
Definition at line 29 of file swappingsmart.hpp.
|
inline |
Definition at line 53 of file swappingsmart.hpp.
|
inline |
Definition at line 31 of file swappingsmart.hpp.
|
inline |
Definition at line 35 of file swappingsmart.hpp.
|
inline |
Definition at line 52 of file swappingsmart.hpp.