File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ struct rust_sched_loop
135
135
void place_task_in_tls (rust_task *task);
136
136
137
137
static rust_task *get_task_tls ();
138
+ static rust_task *try_get_task_tls ();
138
139
139
140
// Called by each task when they are ready to be destroyed
140
141
void release_task (rust_task *task);
@@ -154,7 +155,7 @@ rust_sched_loop::get_log() {
154
155
return _log;
155
156
}
156
157
157
- inline rust_task* rust_sched_loop::get_task_tls ()
158
+ inline rust_task* rust_sched_loop::try_get_task_tls ()
158
159
{
159
160
if (!tls_initialized)
160
161
return NULL ;
@@ -165,6 +166,12 @@ inline rust_task* rust_sched_loop::get_task_tls()
165
166
rust_task *task = reinterpret_cast <rust_task *>
166
167
(pthread_getspecific (task_key));
167
168
#endif
169
+ return task;
170
+ }
171
+
172
+ inline rust_task* rust_sched_loop::get_task_tls ()
173
+ {
174
+ rust_task *task = try_get_task_tls ();
168
175
assert (task && " Couldn't get the task from TLS!" );
169
176
return task;
170
177
}
Original file line number Diff line number Diff line change @@ -619,14 +619,14 @@ rust_task::record_stack_limit() {
619
619
record_sp_limit (stk->data + LIMIT_OFFSET + RED_ZONE_SIZE);
620
620
}
621
621
622
- inline rust_task* rust_get_current_task () {
622
+ inline rust_task* rust_try_get_current_task () {
623
623
uintptr_t sp_limit = get_sp_limit ();
624
624
625
625
// FIXME (#1226) - Because of a hack in upcall_call_shim_on_c_stack this
626
626
// value is sometimes inconveniently set to 0, so we can't use this
627
627
// method of retreiving the task pointer and need to fall back to TLS.
628
628
if (sp_limit == 0 )
629
- return rust_sched_loop::get_task_tls ();
629
+ return rust_sched_loop::try_get_task_tls ();
630
630
631
631
// The stack pointer boundary is stored in a quickly-accessible location
632
632
// 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() {
642
642
return stk->task ;
643
643
}
644
644
645
+ inline rust_task* rust_get_current_task () {
646
+ rust_task* task = rust_try_get_current_task ();
647
+ assert (task != NULL && " no current task" );
648
+ return task;
649
+ }
650
+
645
651
//
646
652
// Local Variables:
647
653
// mode: C++
You can’t perform that action at this time.
0 commit comments