Skip to content

Commit 41ed719

Browse files
return boolean from trylock_pi
1 parent 035a0d2 commit 41ed719

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/thread/futex.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ pub unsafe fn unlock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<()>
384384
/// [Linux `futex` system call]: https://man7.org/linux/man-pages/man2/futex.2.html
385385
/// [Linux `futex` feature]: https://man7.org/linux/man-pages/man7/futex.7.html
386386
#[inline]
387-
pub unsafe fn trylock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<()> {
387+
pub unsafe fn trylock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<bool> {
388388
backend::thread::syscalls::futex_val2(
389389
uaddr,
390390
FutexOperation::TrylockPi,
@@ -393,8 +393,8 @@ pub unsafe fn trylock_pi(uaddr: &AtomicU32, flags: FutexFlags) -> io::Result<()>
393393
0,
394394
ptr::null(),
395395
0,
396-
)?;
397-
Ok(())
396+
)
397+
.map(|ret| ret == 0)
398398
}
399399

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

0 commit comments

Comments
 (0)