diff --git a/zephyr/src/object.rs b/zephyr/src/object.rs index 74fe4ee..6f40ea0 100644 --- a/zephyr/src/object.rs +++ b/zephyr/src/object.rs @@ -188,12 +188,16 @@ where /// /// If it is called an additional time, it will return None. pub fn init_once(&self, args: ::I) -> Option<::T> { - if let Err(_) = self.init.compare_exchange( - KOBJ_UNINITIALIZED, - KOBJ_INITING, - Ordering::AcqRel, - Ordering::Acquire, - ) { + if self + .init + .compare_exchange( + KOBJ_UNINITIALIZED, + KOBJ_INITING, + Ordering::AcqRel, + Ordering::Acquire, + ) + .is_err() + { return None; } let result = self.get_wrapped(args); diff --git a/zephyr/src/sys/thread.rs b/zephyr/src/sys/thread.rs index 90f73b4..f2a8eea 100644 --- a/zephyr/src/sys/thread.rs +++ b/zephyr/src/sys/thread.rs @@ -507,7 +507,7 @@ mod closure { pub unsafe extern "C" fn child(child: *mut c_void, _p2: *mut c_void, _p3: *mut c_void) { let thread_data: Box = unsafe { Box::from_raw(child as *mut ThreadData) }; - let closure = (*thread_data).closure; + let closure = thread_data.closure; closure(); } }