Skip to content

Commit 850faca

Browse files
Document Notify limitation (#373)
1 parent 0624ff3 commit 850faca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sync/notify.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::sync::atomic::Ordering::SeqCst;
77
/// primitives.
88
///
99
/// Notification establishes an acquire / release synchronization point.
10+
/// Only one thread may wait on each `Notify` at a time.
1011
///
1112
/// Using this type is useful to mock out constructs when using loom tests.
1213
#[derive(Debug)]
@@ -26,13 +27,16 @@ impl Notify {
2627
}
2728
}
2829

29-
/// Notify the waiter
30+
/// Notify the waiter.
3031
#[track_caller]
3132
pub fn notify(&self) {
3233
self.object.notify(location!());
3334
}
3435

35-
/// Wait for a notification
36+
/// Wait for a notification.
37+
///
38+
/// # Panics
39+
/// Panics if multiple threads try to wait on the same `Notify` simultaneously.
3640
#[track_caller]
3741
pub fn wait(&self) {
3842
self.waiting

0 commit comments

Comments
 (0)