diff options
author | bors <bors@rust-lang.org> | 2017-10-19 15:06:41 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2017-10-19 15:06:41 +0000 |
commit | 07088d2a0e6fbc106a98dd9475c9df8767831efd (patch) | |
tree | d84ea99d8e1d0ad42539d558a663f503188358b5 | |
parent | 2172bb4bab23457b9fb5f0e464968bce9b45634e (diff) | |
parent | f024fe7dd33f2bea0e316fb73d1de7c7f814a8a3 (diff) | |
download | rust-libc-07088d2a0e6fbc106a98dd9475c9df8767831efd.tar.gz |
Auto merge of #810 - oherrala:pthread_cancel, r=alexcrichton
Introduce pthread_cancel() for terminating threads
pthread_cancel() is safer way to terminate thread than pthread_kill().
This function can be found from ISO/IEC 9945-1:1996 (“POSIX.1”) and first introduced into Single Unix Specification version 2 on 1997.
-rw-r--r-- | src/unix/bsd/mod.rs | 3 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mod.rs | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index ab256d1eb8..a9f9fa87d9 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -491,6 +491,9 @@ extern { oldset: *mut sigset_t) -> ::c_int; pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; pub fn getgrnam(name: *const ::c_char) -> *mut ::group; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "pthread_cancel$UNIX2003")] + pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 0841dd2e5a..c88fe49cd3 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -1411,6 +1411,7 @@ extern { oldset: *mut sigset_t) -> ::c_int; pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; pub fn getgrnam(name: *const ::c_char) -> *mut ::group; + pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; |