Skip to content

Commit

Permalink
Merge #836
Browse files Browse the repository at this point in the history
836: Remove return value from `pause` r=asomers a=Thomasdezeeuw

Follow up on #829, since that repo is now unknown to GitHub.
  • Loading branch information
bors[bot] committed Jan 11, 2018
2 parents 2478f0f + 992c293 commit 5f321db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Both `ip_mreq` and `ipv6_mreq` have been replaced with `IpMembershipRequest` and
`Ipv6MembershipRequest`.
([#814](https://github.com/nix-rust/nix/pull/814))

- Removed return type from `pause`.
([#829](https://github.com/nix-rust/nix/pull/829))

### Fixed
- Fix compilation and tests for OpenBSD targets
Expand Down
10 changes: 4 additions & 6 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,14 +1316,12 @@ pub fn initgroups(user: &CStr, group: Gid) -> Result<()> {
Errno::result(res).map(|_| ())
}

/// Suspend the thread until a signal is received
/// Suspend the thread until a signal is received.
///
/// See also [pause(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pause.html)
/// See also [pause(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pause.html).
#[inline]
pub fn pause() -> Result<()> {
let res = unsafe { libc::pause() };

Errno::result(res).map(drop)
pub fn pause() {
unsafe { libc::pause() };
}

/// Suspend execution for an interval of time
Expand Down
5 changes: 4 additions & 1 deletion test/sys/test_wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ fn test_wait_signal() {

// Safe: The child only calls `pause` and/or `_exit`, which are async-signal-safe.
match fork().expect("Error: Fork Failed") {
Child => pause().unwrap_or_else(|_| unsafe { _exit(123) }),
Child => {
pause();
unsafe { _exit(123) }
},
Parent { child } => {
kill(child, Some(SIGKILL)).expect("Error: Kill Failed");
assert_eq!(waitpid(child, None), Ok(WaitStatus::Signaled(child, SIGKILL, false)));
Expand Down

0 comments on commit 5f321db

Please sign in to comment.