diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp index 8c898e2ac854..cf3b03ee60de 100644 --- a/src/rt/rust_scheduler.cpp +++ b/src/rt/rust_scheduler.cpp @@ -58,12 +58,10 @@ rust_scheduler::~rust_scheduler() { void rust_scheduler::activate(rust_task *task) { - context ctx; - - task->ctx.next = &ctx; + task->ctx.next = &c_context; DLOG(this, task, "descheduling..."); lock.unlock(); - task->ctx.swap(ctx); + task->ctx.swap(c_context); lock.lock(); DLOG(this, task, "task has returned"); } diff --git a/src/rt/rust_scheduler.h b/src/rt/rust_scheduler.h index fe8e000ad391..ad3203e43c33 100644 --- a/src/rt/rust_scheduler.h +++ b/src/rt/rust_scheduler.h @@ -1,6 +1,8 @@ #ifndef RUST_SCHEDULER_H #define RUST_SCHEDULER_H +#include "context.h" + #ifndef _WIN32 #include #else @@ -72,6 +74,7 @@ struct rust_scheduler : public kernel_owned, static bool tls_initialized; rust_env *env; + context c_context; // Only a pointer to 'name' is kept, so it must live as long as this // domain.