aboutsummaryrefslogtreecommitdiff
path: root/src/sync/barrier.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync/barrier.rs')
-rw-r--r--src/sync/barrier.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/sync/barrier.rs b/src/sync/barrier.rs
index a8b291f..e3c95f6 100644
--- a/src/sync/barrier.rs
+++ b/src/sync/barrier.rs
@@ -2,7 +2,7 @@ use crate::sync::watch;
use std::sync::Mutex;
-/// A barrier enables multiple threads to synchronize the beginning of some computation.
+/// A barrier enables multiple tasks to synchronize the beginning of some computation.
///
/// ```
/// # #[tokio::main]
@@ -52,10 +52,10 @@ struct BarrierState {
}
impl Barrier {
- /// Creates a new barrier that can block a given number of threads.
+ /// Creates a new barrier that can block a given number of tasks.
///
- /// A barrier will block `n`-1 threads which call [`Barrier::wait`] and then wake up all
- /// threads at once when the `n`th thread calls `wait`.
+ /// A barrier will block `n`-1 tasks which call [`Barrier::wait`] and then wake up all
+ /// tasks at once when the `n`th task calls `wait`.
pub fn new(mut n: usize) -> Barrier {
let (waker, wait) = crate::sync::watch::channel(0);
@@ -79,11 +79,11 @@ impl Barrier {
/// Does not resolve until all tasks have rendezvoused here.
///
- /// Barriers are re-usable after all threads have rendezvoused once, and can
+ /// Barriers are re-usable after all tasks have rendezvoused once, and can
/// be used continuously.
///
/// A single (arbitrary) future will receive a [`BarrierWaitResult`] that returns `true` from
- /// [`BarrierWaitResult::is_leader`] when returning from this function, and all other threads
+ /// [`BarrierWaitResult::is_leader`] when returning from this function, and all other tasks
/// will receive a result that will return `false` from `is_leader`.
pub async fn wait(&self) -> BarrierWaitResult {
// NOTE: we are taking a _synchronous_ lock here.
@@ -129,14 +129,14 @@ impl Barrier {
}
}
-/// A `BarrierWaitResult` is returned by `wait` when all threads in the `Barrier` have rendezvoused.
+/// A `BarrierWaitResult` is returned by `wait` when all tasks in the `Barrier` have rendezvoused.
#[derive(Debug, Clone)]
pub struct BarrierWaitResult(bool);
impl BarrierWaitResult {
- /// Returns `true` if this thread from wait is the "leader thread".
+ /// Returns `true` if this task from wait is the "leader task".
///
- /// Only one thread will have `true` returned from their result, all other threads will have
+ /// Only one task will have `true` returned from their result, all other tasks will have
/// `false` returned.
pub fn is_leader(&self) -> bool {
self.0