Skip to content

Commit e4b2870

Browse files
committed
Add comments describing AwaitNotify struct
And remove an unnneded comment in a Debug implementation
1 parent 552928d commit e4b2870

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/sync/condvar.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,23 @@ impl Condvar {
361361

362362
impl fmt::Debug for Condvar {
363363
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
364-
//f.debug_struct("Condvar").finish()
365364
f.pad("Condvar { .. }")
366365
}
367366
}
368367

368+
/// A future that waits for another task to notify the condition variable.
369+
///
370+
/// This is an internal future that `wait` and `wait_until` await on.
369371
struct AwaitNotify<'a, 'b, T> {
372+
/// The condition variable that we are waiting on
370373
cond: &'a Condvar,
374+
/// The lock used with `cond`.
375+
/// This will be released the first time the future is polled,
376+
/// after registering the context to be notified.
371377
guard: Option<MutexGuard<'b, T>>,
378+
/// A key into the conditions variable's `WakerSet`.
379+
/// This is set to the index of the `Waker` for the context each time
380+
/// the future is polled and not completed.
372381
key: Option<usize>,
373382
}
374383

0 commit comments

Comments
 (0)