]> git.lizzy.rs Git - rust.git/commitdiff
Tuning pthread_key_t type
authorMichael Neumann <mneumann@ntecs.de>
Tue, 6 Jan 2015 09:53:32 +0000 (10:53 +0100)
committerValerii Hiora <valerii.hiora@gmail.com>
Tue, 6 Jan 2015 18:12:19 +0000 (20:12 +0200)
Both FreeBSD and DragonFly define pthread_key_t as int, while Linux
defines it as uint. As pthread_key_t is used as an opaque type and
storage size of both int and uint are the same, this is rather a
cosmetic change.

iOS uses ulong (as OS X) so difference is critical on 64bit platforms.

src/libstd/sys/unix/thread_local.rs

index e507377a8fcdd880a01c5b98ee53145a7463cfaa..ea1e9c261fecfbb4279c3e228d5f3512d62b16f5 100644 (file)
@@ -37,10 +37,18 @@ pub unsafe fn destroy(key: Key) {
     debug_assert_eq!(r, 0);
 }
 
-#[cfg(target_os = "macos")]
+#[cfg(any(target_os = "macos",
+          target_os = "ios"))]
 type pthread_key_t = ::libc::c_ulong;
 
-#[cfg(not(target_os = "macos"))]
+#[cfg(any(target_os = "freebsd",
+          target_os = "dragonfly"))]
+type pthread_key_t = ::libc::c_int;
+
+#[cfg(not(any(target_os = "macos",
+              target_os = "ios",
+              target_os = "freebsd",
+              target_os = "dragonfly")))]
 type pthread_key_t = ::libc::c_uint;
 
 extern {