about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-03-15 18:06:19 -0700
committerBrian Anderson <banderson@mozilla.com>2013-03-18 17:00:35 -0700
commit044703435ba7e1338456f7a83393eb2c6fecf238 (patch)
tree9edfdc6ab1ab28e4c7abcf3176b073bda939f88b /src/rt/rust_builtin.cpp
parenta882554a785152c74c96cee036d252b071ed5ce1 (diff)
downloadrust-044703435ba7e1338456f7a83393eb2c6fecf238.tar.gz
rust-044703435ba7e1338456f7a83393eb2c6fecf238.zip
Add a way to run the test suite with the new scheduler
TESTARGS=--newrt make check-stage1-rpass

Conflicts:
	src/rt/rustrt.def.in
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index a2053c115bb..9349db17d56 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -882,6 +882,37 @@ rust_get_rt_env() {
     return task->kernel->env;
 }
 
+typedef void *(*nullary_fn)();
+
+extern "C" CDECL void
+rust_call_nullary_fn(nullary_fn f) {
+    f();
+}
+
+
+#ifndef _WIN32
+pthread_key_t sched_key;
+#else
+DWORD sched_key;
+#endif
+
+extern "C" void*
+rust_get_sched_tls_key() {
+    return &sched_key;
+}
+
+extern "C" CDECL void
+rust_initialize_global_state() {
+
+#ifndef _WIN32
+    assert(!pthread_key_create(&sched_key, NULL));
+#else
+    sched_key = TlsAlloc();
+    assert(sched_key != TLS_OUT_OF_INDEXES);
+#endif
+
+}
+
 //
 // Local Variables:
 // mode: C++