Skip to content

Commit 3d442c7

Browse files
committed
minor tweaks
1 parent 7e44578 commit 3d442c7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/use_file.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ fn open_or_wait() -> Result<libc::c_int, Error> {
7373
Err(_) => FD_UNINIT,
7474
};
7575
FD.store(val, Ordering::Release);
76+
77+
// On non-Linux targets `wait` is just 1 ms sleep,
78+
// so we don't need any explicit wake up in addition
79+
// to updating value of `FD`.
80+
#[cfg(any(target_os = "android", target_os = "linux"))]
7681
sync::wake();
82+
7783
res
7884
}
7985

@@ -101,14 +107,11 @@ mod sync {
101107
tv_sec: 0,
102108
tv_nsec: 0,
103109
};
104-
// We ignore return value since we do not care
105-
// if sleep is interrupted
110+
// We do not care if sleep gets interrupted, so the return value is ignored
106111
unsafe {
107112
libc::nanosleep(&rqtp, &mut rmtp);
108113
}
109114
}
110-
111-
pub(super) fn wake() {}
112115
}
113116

114117
#[cfg(any(target_os = "android", target_os = "linux"))]

0 commit comments

Comments
 (0)