pub struct RcuArc<T: Send + Sync + 'static> { /* private fields */ }Expand description
An RCU (Read-Copy-Update) wrapper around an Arc.
The Arc can be dereferenced from multiple threads concurrently without blocking. When the Arc is replaced, reads may continue to see the old Arc pointer for some period of time.
Implementations§
Source§impl<T: Send + Sync + 'static> RcuArc<T>
impl<T: Send + Sync + 'static> RcuArc<T>
Sourcepub fn read(&self) -> RcuReadGuard<T>
pub fn read(&self) -> RcuReadGuard<T>
Read the value of the wrapped Arc.
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 as_ref<'a>(&self, scope: &'a RcuReadScope) -> &'a T
pub fn as_ref<'a>(&self, scope: &'a RcuReadScope) -> &'a T
Returns a reference to the value of the wrapped Arc.
The object referenced by the RCU Arc will remain valid until the RcuReadScope is dropped.
However, another thread running concurrently might see a different value for the object.
Sourcepub fn update(&self, data: Arc<T>)
pub fn update(&self, data: Arc<T>)
Write a new Arc to the RCU wrapper.
Concurrent readers may continue to see the old Arc pointer until the RCU state machine has made sufficient progress to ensure that no concurrent readers are holding read guards.
Sourcepub fn update_swap<'a>(&self, scope: &'a RcuReadScope, data: Arc<T>) -> &'a T
pub fn update_swap<'a>(&self, scope: &'a RcuReadScope, data: Arc<T>) -> &'a T
Write a new Arc to the RCU wrapper and return a reference to the old value.
Concurrent readers may continue to see the old Arc pointer until the RCU state machine has made sufficient progress to ensure that no concurrent readers are holding read guards.