Skip to content

Commit

Permalink
return boolean from trylock_pi
Browse files Browse the repository at this point in the history
  • Loading branch information
danielschemmel committed Aug 4, 2024
1 parent 035a0d2 commit 7898d3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/thread/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ pub unsafe fn unlock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<()>
/// [Linux `futex` system call]: https://man7.org/linux/man-pages/man2/futex.2.html
/// [Linux `futex` feature]: https://man7.org/linux/man-pages/man7/futex.7.html
#[inline]
pub unsafe fn trylock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<()> {
pub unsafe fn trylock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<bool> {
backend::thread::syscalls::futex_val2(
uaddr,
FutexOperation::TrylockPi,
Expand All @@ -393,8 +393,8 @@ pub unsafe fn trylock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<()>
0,
ptr::null(),
0,
)?;
Ok(())
)
.map(|ret| ret == 0);
}

/// Equivalent to `syscall(SYS_futex, uaddr, FUTEX_WAIT_BITSET, val, timeout/val2, NULL, val3)`
Expand Down

0 comments on commit 7898d3f

Please sign in to comment.