File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -508,9 +508,25 @@ pub fn sleep(dur: Duration) {
508
508
imp:: Thread :: sleep ( dur)
509
509
}
510
510
511
- /// Blocks unless or until the current thread's token is made available (may wake spuriously) .
511
+ /// Blocks unless or until the current thread's token is made available.
512
512
///
513
- /// See the module doc for more detail.
513
+ /// Every thread is equipped with some basic low-level blocking support, via
514
+ /// the `park()` function and the [`unpark()`][unpark] method. These can be
515
+ /// used as a more CPU-efficient implementation of a spinlock.
516
+ ///
517
+ /// [unpark]: struct.Thread.html#method.unpark
518
+ ///
519
+ /// The API is typically used by acquiring a handle to the current thread,
520
+ /// placing that handle in a shared data structure so that other threads can
521
+ /// find it, and then parking (in a loop with a check for the token actually
522
+ /// being acquired).
523
+ ///
524
+ /// A call to `park` does not guarantee that the thread will remain parked
525
+ /// forever, and callers should be prepared for this possibility.
526
+ ///
527
+ /// See the [module documentation][thread] for more detail.
528
+ ///
529
+ /// [thread]: index.html
514
530
//
515
531
// The implementation currently uses the trivial strategy of a Mutex+Condvar
516
532
// with wakeup flag, which does not actually allow spurious wakeups. In the
You can’t perform that action at this time.
0 commit comments