Skip to content

Commit 134eb0e

Browse files
mneumannvhbit
authored andcommitted
Tuning pthread_key_t type
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.
1 parent 8efd990 commit 134eb0e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/libstd/sys/unix/thread_local.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,18 @@ pub unsafe fn destroy(key: Key) {
3737
debug_assert_eq!(r, 0);
3838
}
3939

40-
#[cfg(target_os = "macos")]
40+
#[cfg(any(target_os = "macos",
41+
target_os = "ios"))]
4142
type pthread_key_t = ::libc::c_ulong;
4243

43-
#[cfg(not(target_os = "macos"))]
44+
#[cfg(any(target_os = "freebsd",
45+
target_os = "dragonfly"))]
46+
type pthread_key_t = ::libc::c_int;
47+
48+
#[cfg(not(any(target_os = "macos",
49+
target_os = "ios",
50+
target_os = "freebsd",
51+
target_os = "dragonfly")))]
4452
type pthread_key_t = ::libc::c_uint;
4553

4654
extern {

0 commit comments

Comments
 (0)