File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,16 @@ pub fn yield_now() {
458
458
459
459
/// Determines whether the current thread is unwinding because of panic.
460
460
///
461
+ /// A common use of this feature is to poison shared resources when writing
462
+ /// unsafe code, by checking `panicking` when the `drop` is called.
463
+ ///
464
+ /// This is usually not needed when writing safe code, as [`Mutex`es][Mutex]
465
+ /// already poison themselves when a thread panics while holding the lock.
466
+ ///
467
+ /// This can also be used in multithreaded applications, in order to send a
468
+ /// message to other threads warning that a thread has panicked (e.g. for
469
+ /// monitoring purposes).
470
+ ///
461
471
/// # Examples
462
472
///
463
473
/// ```should_panic
@@ -486,6 +496,8 @@ pub fn yield_now() {
486
496
/// panic!()
487
497
/// }
488
498
/// ```
499
+ ///
500
+ /// [Mutex]: ../../std/sync/struct.Mutex.html
489
501
#[ inline]
490
502
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
491
503
pub fn panicking ( ) -> bool {
You can’t perform that action at this time.
0 commit comments