From 7898d3f570989fe094bc6e8ea8f71ddd184109e4 Mon Sep 17 00:00:00 2001 From: Daniel Schemmel Date: Sun, 4 Aug 2024 14:42:33 +0100 Subject: [PATCH] return boolean from trylock_pi --- src/thread/futex.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thread/futex.rs b/src/thread/futex.rs index e89292e5e..2aa560ac2 100644 --- a/src/thread/futex.rs +++ b/src/thread/futex.rs @@ -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 { backend::thread::syscalls::futex_val2( uaddr, FutexOperation::TrylockPi, @@ -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)`