diff --git a/src/platform/synchronization.rs b/src/platform/synchronization.rs index 73ae823c6..dbd9d94b8 100644 --- a/src/platform/synchronization.rs +++ b/src/platform/synchronization.rs @@ -25,11 +25,12 @@ pub struct z_mutex_t(usize); impl_guarded_transmute!(z_mutex_t, ZMutexPtr); impl_guarded_transmute!(ZMutexPtr, z_mutex_t); -// try to use the same error codes as in GNU pthreads -const EBUSY: i8 = 16; -const EINVAL: i8 = 22; -const EAGAIN: i8 = 11; -const EPOISON: i8 = 22; // same as EINVAL +// using the same error codes as in GNU pthreads, but with negative sign +// due to convention to return negative values on error +const EBUSY: i8 = -16; +const EINVAL: i8 = -22; +const EAGAIN: i8 = -11; +const EPOISON: i8 = -22; // same as EINVAL #[no_mangle] #[allow(clippy::missing_safety_doc)]