about summary refs log tree commit diff
path: root/src/rt/rust.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-02-03 18:15:43 -0800
committerBrian Anderson <banderson@mozilla.com>2013-03-11 19:44:29 -0700
commit676e0290ed4d306e6d7b517de1409c109309a0b2 (patch)
tree2aa22a3dbbdbf2364a41feba5f358dfd3e979574 /src/rt/rust.cpp
parenta6bb4a0f1a61ab00e09c4cb24dfff95c6c2481c7 (diff)
downloadrust-676e0290ed4d306e6d7b517de1409c109309a0b2.tar.gz
rust-676e0290ed4d306e6d7b517de1409c109309a0b2.zip
core: Add rt mod and add the new scheduler code
Diffstat (limited to 'src/rt/rust.cpp')
-rw-r--r--src/rt/rust.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 803da32cbc8..d9ef6a52dbe 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -21,6 +21,17 @@
 
 void* global_crate_map = NULL;
 
+#ifndef _WIN32
+pthread_key_t sched_key;
+#else
+DWORD sched_key;
+#endif
+
+extern "C" void*
+rust_get_sched_tls_key() {
+    return &sched_key;
+}
+
 /**
    The runtime entrypoint. The (C ABI) main function generated by rustc calls
    `rust_start`, providing the address of the Rust ABI main function, the
@@ -30,6 +41,10 @@ void* global_crate_map = NULL;
 extern "C" CDECL int
 rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
 
+#ifndef _WIN32
+    pthread_key_create(&sched_key, NULL);
+#endif
+
     // Load runtime configuration options from the environment.
     // FIXME #1497: Should provide a way to get these from the command
     // line as well.