rt: Expose the C stack inside the Rust scheduler so that C calls can switch to it
This commit is contained in:
parent
dbf472b0df
commit
e8757ea01f
2 changed files with 5 additions and 4 deletions
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef RUST_SCHEDULER_H
|
||||
#define RUST_SCHEDULER_H
|
||||
|
||||
#include "context.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pthread.h>
|
||||
#else
|
||||
|
@ -72,6 +74,7 @@ struct rust_scheduler : public kernel_owned<rust_scheduler>,
|
|||
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.
|
||||
|
|
Loading…
Reference in a new issue