Skip to content

Commit 101aaa3

Browse files
committed
core::rt: 0 is a valid TLS key
1 parent d234cf7 commit 101aaa3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/libcore/rt/local_sched.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn maybe_tls_key() -> Option<tls::Key> {
119119
// another thread. I think this is fine since the only action
120120
// they could take if it was initialized would be to check the
121121
// thread-local value and see that it's not set.
122-
if key != 0 {
122+
if key != -1 {
123123
return Some(key);
124124
} else {
125125
return None;

src/rt/rust_builtin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,9 +830,9 @@ rust_get_rt_env() {
830830
}
831831

832832
#ifndef _WIN32
833-
pthread_key_t sched_key;
833+
pthread_key_t sched_key = -1;
834834
#else
835-
DWORD sched_key;
835+
DWORD sched_key = -1;
836836
#endif
837837

838838
extern "C" void*

0 commit comments

Comments
 (0)