diff options
author | Ossi Herrala <oherrala@iki.fi> | 2017-10-18 13:48:31 +0300 |
---|---|---|
committer | Ossi Herrala <oherrala@iki.fi> | 2017-10-18 15:53:10 +0300 |
commit | fcc8237add51afa8b075805c0d2693dd70cfbe5a (patch) | |
tree | 012a5210464bb97cd7ec9f4075e0a3cc105f8e04 | |
parent | 84da91cebe22c1368f890f5cabc354e7f2082cc0 (diff) | |
download | rust-libc-fcc8237add51afa8b075805c0d2693dd70cfbe5a.tar.gz |
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 | 1 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mod.rs | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index ab256d1eb8..1a7d22ab34 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -491,6 +491,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; 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; |