From 8ced4c0a8cbc4ae1a50f8c55b137ed3982d73b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fa=CC=81bio=20Botelho?= <dev.fbotelho@gmail.com> Date: Sun, 9 Aug 2020 18:17:08 +0100 Subject: [PATCH] Add mac/ios pthread_from_mach_thread_np Allows us to get a pthread id from a match thread id. From pthread.h [1]: ``` __API_AVAILABLE(macos(10.5), ios(2.0)) _Nullable pthread_t pthread_from_mach_thread_np(mach_port_t); ``` [1] - https://opensource.apple.com/source/libpthread/libpthread-416.40.3/pthread/pthread.h.auto.html --- src/unix/bsd/apple/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index f1309747..39301ed4 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -35,6 +35,8 @@ pub type shmatt_t = ::c_ushort; pub type sae_associd_t = u32; pub type sae_connid_t = u32; +pub type mach_port_t = ::c_uint; + deprecated_mach! { pub type vm_prot_t = ::c_int; pub type vm_size_t = ::uintptr_t; @@ -3395,6 +3397,7 @@ extern "C" { name: *mut ::c_char, len: ::size_t, ) -> ::c_int; + pub fn pthread_from_mach_thread_np(port: ::mach_port_t) -> ::pthread_t; pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void; pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t; pub fn pthread_condattr_setpshared( -- GitLab