Skip to content

Commit 86ba457

Browse files
committed
rt: Rename rust_initialize_global_state to rust_initialize_rt_tls_key
1 parent f59fcd5 commit 86ba457

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/libcore/rt/local_sched.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ use unstable::finally::Finally;
2323

2424
#[cfg(test)] use rt::uv::uvio::UvEventLoop;
2525

26+
/// Initialize the TLS key. Other ops will fail if this isn't executed first.
27+
pub fn init_tls_key() {
28+
unsafe {
29+
rust_initialize_rt_tls_key();
30+
extern {
31+
fn rust_initialize_rt_tls_key();
32+
}
33+
}
34+
}
35+
2636
/// Give the Scheduler to thread-local storage
2737
pub fn put(sched: ~Scheduler) {
2838
unsafe {

src/libcore/rt/sched.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,8 @@ pub impl Scheduler {
6464

6565
fn new(event_loop: ~EventLoopObject) -> Scheduler {
6666

67-
// Lazily initialize the global state, currently the scheduler TLS key
68-
unsafe { rust_initialize_global_state(); }
69-
extern {
70-
fn rust_initialize_global_state();
71-
}
67+
// Lazily initialize the scheduler TLS key
68+
local_sched::init_tls_key();
7269

7370
Scheduler {
7471
event_loop: event_loop,

src/rt/rust_builtin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,9 @@ rust_get_rt_tls_key() {
840840
return &rt_key;
841841
}
842842

843-
// Initialize the global state required by the new scheduler
843+
// Initialize the TLS key used by the new scheduler
844844
extern "C" CDECL void
845-
rust_initialize_global_state() {
845+
rust_initialize_rt_tls_key() {
846846

847847
static lock_and_signal init_lock;
848848
static bool initialized = false;

src/rt/rustrt.def.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ rust_uv_ip4_addrp
222222
rust_uv_ip6_addrp
223223
rust_uv_free_ip4_addr
224224
rust_uv_free_ip6_addr
225-
rust_initialize_global_state
225+
rust_initialize_rt_tls_key
226226
rust_dbg_next_port
227227
rust_new_memory_region
228228
rust_delete_memory_region

0 commit comments

Comments
 (0)