Added inheritance for task pinning. Closes #598 for real.

This commit is contained in:
Eric Holk
2011-06-29 18:56:34 -07:00
parent 63dcd325b9
commit b3e5b5bd05
3 changed files with 9 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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();
};