File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
library/std/src/sys/sync/mutex Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,14 @@ impl Mutex {
1919 }
2020
2121 #[ inline]
22+ // Make this a diagnostic item for Miri's concurrency model checker.
2223 #[ cfg_attr( not( test) , rustc_diagnostic_item = "sys_mutex_try_lock" ) ]
2324 pub fn try_lock ( & self ) -> bool {
2425 self . futex . compare_exchange ( UNLOCKED , LOCKED , Acquire , Relaxed ) . is_ok ( )
2526 }
2627
2728 #[ inline]
29+ // Make this a diagnostic item for Miri's concurrency model checker.
2830 #[ cfg_attr( not( test) , rustc_diagnostic_item = "sys_mutex_lock" ) ]
2931 pub fn lock ( & self ) {
3032 if self . futex . compare_exchange ( UNLOCKED , LOCKED , Acquire , Relaxed ) . is_err ( ) {
@@ -82,6 +84,7 @@ impl Mutex {
8284 }
8385
8486 #[ inline]
87+ // Make this a diagnostic item for Miri's concurrency model checker.
8588 #[ cfg_attr( not( test) , rustc_diagnostic_item = "sys_mutex_unlock" ) ]
8689 pub unsafe fn unlock ( & self ) {
8790 if self . futex . swap ( UNLOCKED , Release ) == CONTENDED {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ impl Mutex {
2828 }
2929
3030 #[ inline]
31+ // Make this a diagnostic item for Miri's concurrency model checker.
3132 #[ cfg_attr( not( test) , rustc_diagnostic_item = "sys_mutex_lock" ) ]
3233 pub fn lock ( & self ) {
3334 // SAFETY: we call `init` above, therefore reentrant locking is safe.
@@ -36,6 +37,7 @@ impl Mutex {
3637 }
3738
3839 #[ inline]
40+ // Make this a diagnostic item for Miri's concurrency model checker.
3941 #[ cfg_attr( not( test) , rustc_diagnostic_item = "sys_mutex_unlock" ) ]
4042 pub unsafe fn unlock ( & self ) {
4143 // SAFETY: the mutex can only be locked if it is already initialized
@@ -44,6 +46,7 @@ impl Mutex {
4446 }
4547
4648 #[ inline]
49+ // Make this a diagnostic item for Miri's concurrency model checker.
4750 #[ cfg_attr( not( test) , rustc_diagnostic_item = "sys_mutex_try_lock" ) ]
4851 pub fn try_lock ( & self ) -> bool {
4952 // SAFETY: we call `init` above, therefore reentrant locking is safe.
You can’t perform that action at this time.
0 commit comments