Skip to content

Commit 3d0e7a7

Browse files
committed
rt: Add a field to rust_task to hold its scheduler
1 parent 8d88196 commit 3d0e7a7

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/rt/rust_builtin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ start_task(rust_task_id id, fn_env_pair *f) {
417417
extern "C" CDECL int
418418
sched_threads() {
419419
rust_task *task = rust_task_thread::get_task();
420-
return task->thread->sched->number_of_threads();
420+
return task->sched->number_of_threads();
421421
}
422422

423423
extern "C" CDECL rust_port*

src/rt/rust_task.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ rust_task::rust_task(rust_task_thread *thread, rust_task_list *state,
233233
ref_count(1),
234234
stk(NULL),
235235
runtime_sp(0),
236+
sched(thread->sched),
236237
thread(thread),
237238
cache(NULL),
238239
kernel(thread->kernel),

src/rt/rust_task.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ rust_task : public kernel_owned<rust_task>, rust_cond
7272

7373
RUST_ATOMIC_REFCOUNT();
7474

75-
// Fields known to the compiler.
7675
context ctx;
7776
stk_seg *stk;
7877
uintptr_t runtime_sp; // Runtime sp while task running.
78+
rust_scheduler *sched;
7979
rust_task_thread *thread;
8080
rust_crate_cache *cache;
8181

0 commit comments

Comments
 (0)