From 3d442c768629d0692ab4fbd97c88809d9c3deb41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 21 Jun 2024 16:19:26 +0300 Subject: [PATCH] minor tweaks --- src/use_file.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/use_file.rs b/src/use_file.rs index 1385e66b..247272dc 100644 --- a/src/use_file.rs +++ b/src/use_file.rs @@ -73,7 +73,13 @@ fn open_or_wait() -> Result { Err(_) => FD_UNINIT, }; FD.store(val, Ordering::Release); + + // On non-Linux targets `wait` is just 1 ms sleep, + // so we don't need any explicit wake up in addition + // to updating value of `FD`. + #[cfg(any(target_os = "android", target_os = "linux"))] sync::wake(); + res } @@ -101,14 +107,11 @@ mod sync { tv_sec: 0, tv_nsec: 0, }; - // We ignore return value since we do not care - // if sleep is interrupted + // We do not care if sleep gets interrupted, so the return value is ignored unsafe { libc::nanosleep(&rqtp, &mut rmtp); } } - - pub(super) fn wake() {} } #[cfg(any(target_os = "android", target_os = "linux"))]