summary refs log tree commit diff
path: root/src/rt/rust_task.h
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-01-11 00:27:27 -0800
committerBrian Anderson <banderson@mozilla.com>2013-02-06 11:56:32 -0800
commita8c8bfc7b5525a83fab65f527345bb6ca46d4e25 (patch)
treed0f239eda07b7b5b169ea950e5ac2ddb5cc4f7fc /src/rt/rust_task.h
parent801f3225b24a796402b83f660f80e62ac504befe (diff)
downloadrust-a8c8bfc7b5525a83fab65f527345bb6ca46d4e25.tar.gz
rust-a8c8bfc7b5525a83fab65f527345bb6ca46d4e25.zip
rt: Add rust_try_get_current_task
Diffstat (limited to 'src/rt/rust_task.h')
-rw-r--r--src/rt/rust_task.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index bff4af09b32..cbde863fa23 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -619,14 +619,14 @@ rust_task::record_stack_limit() {
     record_sp_limit(stk->data + LIMIT_OFFSET + RED_ZONE_SIZE);
 }
 
-inline rust_task* rust_get_current_task() {
+inline rust_task* rust_try_get_current_task() {
     uintptr_t sp_limit = get_sp_limit();
 
     // FIXME (#1226) - Because of a hack in upcall_call_shim_on_c_stack this
     // value is sometimes inconveniently set to 0, so we can't use this
     // method of retreiving the task pointer and need to fall back to TLS.
     if (sp_limit == 0)
-        return rust_sched_loop::get_task_tls();
+        return rust_sched_loop::try_get_task_tls();
 
     // The stack pointer boundary is stored in a quickly-accessible location
     // in the TCB. From that we can calculate the address of the stack segment
@@ -642,6 +642,12 @@ inline rust_task* rust_get_current_task() {
     return stk->task;
 }
 
+inline rust_task* rust_get_current_task() {
+    rust_task* task = rust_try_get_current_task();
+    assert(task != NULL && "no current task");
+    return task;
+}
+
 //
 // Local Variables:
 // mode: C++