Skip to content

Commit abb190e

Browse files
committed
imporve documentation
1 parent ecbcdc8 commit abb190e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/write.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,17 @@ where
293293
}
294294
}
295295

296-
/// Publishes if all writers have moved to other side without spinning.
296+
/// Try to publish once without waiting.
297297
///
298-
/// This method needs is difftent then publish to only check the readers once and publish
299-
/// if all readers have moved. Returns true if it was sucessfully
298+
/// This performs a single, non-blocking check of reader epochs. If all current readers have
299+
/// advanced since the last swap, it performs a publish and returns `true`. If any reader may
300+
/// still be accessing the old copy, it does nothing and returns `false`.
301+
///
302+
/// Unlike [`publish`](Self::publish), this never spins or waits. Use it on latency-sensitive
303+
/// paths where skipping a publish is preferable to blocking; call again later or fall back to
304+
/// [`publish`](Self::publish) if you must ensure visibility.
305+
///
306+
/// Returns `true` if a publish occurred, `false` otherwise.
300307
301308
pub fn try_publish(&mut self) -> bool {
302309
let epochs = Arc::clone(&self.epochs);

0 commit comments

Comments
 (0)