Skip to content

Commit

Permalink
📝 update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Xudong-Huang committed Dec 9, 2024
1 parent 870337a commit b6eea71
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,10 @@ impl<T> RcuCell<T> {
self.set(Some(data))
}

/// atomicly update the value with a closure and return the old value
/// the closure will be called with a reference to the old value
/// the closure should not take too long time
/// Atomicly update the value with a closure and return the old value.
/// The closure will be called with the old value and return the new value.
/// The closure should not take too long time, internally it's use a spin
/// lock to prevent other writer to update the value
pub fn update<R, F>(&self, f: F) -> Option<Arc<T>>
where
F: FnOnce(Option<Arc<T>>) -> Option<R>,
Expand Down

0 comments on commit b6eea71

Please sign in to comment.