pub struct RcuOptionArc<T: Send + Sync + 'static> { /* private fields */ }Expand description
An RCU (Read-Copy-Update) version of Option<Arc<...>>.
This Arc can be read from multiple threads concurrently without blocking. When the Arc is written, reads may continue to see the old value of the Arc for some period of time.
Implementations§
Source§impl<T: Send + Sync + 'static> RcuOptionArc<T>
impl<T: Send + Sync + 'static> RcuOptionArc<T>
Sourcepub fn read(&self) -> Option<RcuReadGuard<T>>
pub fn read(&self) -> Option<RcuReadGuard<T>>
Read the value of the RcuOptionArc.
The object referenced by the RCU Arc will remain valid until the RcuReadGuard is dropped.
However, another thread running concurrently might see a different value for the object.
Sourcepub fn update(&self, data: Option<Arc<T>>)
pub fn update(&self, data: Option<Arc<T>>)
Write the value of the RcuOptionArc.
Concurrent readers may continue to see the old value of the Arc until the RCU state machine has made sufficient progress to ensure that no concurrent readers are holding read guards.
Sourcepub fn to_option_arc(&self) -> Option<Arc<T>>
pub fn to_option_arc(&self) -> Option<Arc<T>>
Create a new Option<Arc<T>> to the object referenced by the RcuOptionArc.
This function returns a new Option<Arc<T>> to the object referenced by the RcuOptionArc,
potentially increasing the reference count of the object by one.