Skip to content

Commit

Permalink
be even more explicit about what happens when copying os_unfair_lock
Browse files Browse the repository at this point in the history
Co-authored-by: Ralf Jung <[email protected]>
  • Loading branch information
joboet and RalfJung authored Jul 14, 2024
1 parent d70fd08 commit 2b9ee8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/pass-dep/concurrency/apple-os-unfair-lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ fn main() {
libc::os_unfair_lock_assert_not_owner(lock.get());
}

// `os_unfair_lock`s can be moved and leaked, even when locked,
// as long as no operation is occurring on the lock:
// `os_unfair_lock`s can be moved and leaked.
// In the real implementation, even moving it while locked is possible
// (and "forks" the lock, i.e. old and new location have independent wait queues);
// Miri behavior differs here and anyway none of this is documented.
let lock = lock;
let locked = unsafe { libc::os_unfair_lock_trylock(lock.get()) };
assert!(locked);
Expand Down

0 comments on commit 2b9ee8b

Please sign in to comment.