Skip to content

Commit ed61bd8

Browse files
committed
rollup merge of #20652: vhbit/thread-key-type
This is a manual merge of #20627 and #20634 to avoid conflicts in rollup and also avoid one roundtrip. I've leave copyright to original author. If this one is moved to rollup original PR could be closed. cc @mneumann @alexcrichton r? 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.
2 parents acc5d79 + 134eb0e commit ed61bd8

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)