Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Jun 21, 2024
1 parent 7e44578 commit 3d442c7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/use_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ fn open_or_wait() -> Result<libc::c_int, Error> {
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
}

Expand Down Expand Up @@ -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"))]
Expand Down

0 comments on commit 3d442c7

Please sign in to comment.