Added inheritance for task pinning. Closes #598 for real.
This commit is contained in:
@@ -291,6 +291,8 @@ rust_scheduler::create_task(rust_task *spawner, const char *name) {
|
||||
new (this->kernel) rust_task (this, &newborn_tasks, spawner, name);
|
||||
DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s",
|
||||
task, spawner ? spawner->name : "null", name);
|
||||
if(spawner)
|
||||
task->pin(spawner->pinned_on);
|
||||
newborn_tasks.append(task);
|
||||
return task;
|
||||
}
|
||||
|
||||
@@ -528,9 +528,15 @@ rust_task::free(void *mem, memory_region::memory_region_type type) {
|
||||
}
|
||||
|
||||
void rust_task::pin() {
|
||||
I(this->sched, running_on != -1);
|
||||
pinned_on = running_on;
|
||||
}
|
||||
|
||||
void rust_task::pin(int id) {
|
||||
I(this->sched, running_on == -1);
|
||||
pinned_on = id;
|
||||
}
|
||||
|
||||
void rust_task::unpin() {
|
||||
pinned_on = -1;
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ rust_task : public maybe_proxy<rust_task>,
|
||||
void free(void *mem, memory_region::memory_region_type type);
|
||||
|
||||
void pin();
|
||||
void pin(int id);
|
||||
void unpin();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user