diff options
author | Pixel <pixel@nobis-crew.org> | 2011-10-07 15:36:12 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-10-07 15:36:12 -0700 |
commit | 1d9def9edae0011eeee8f83dc32fb3797ca2f46b (patch) | |
tree | 29077945287dd4b0c13269b9f3e5dc97936551f9 /src/Task.cc | |
parent | 5a283e5b2b523d53e3504292c386b534dc74386a (diff) |
More work in the Task manager.
Also fixing a few bugs linked with the printer and TLS.
Removed flto from compilation flags: this actually creates bad code (!)
Diffstat (limited to 'src/Task.cc')
-rw-r--r-- | src/Task.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Task.cc b/src/Task.cc index d41f088..9bdad0c 100644 --- a/src/Task.cc +++ b/src/Task.cc @@ -9,10 +9,16 @@ Balau::Task::Task() { stack = malloc(size); coro_create(&ctx, coroutine, this, stack, size); taskMan = TaskMan::getTaskMan(); + taskMan->registerTask(this); tls = tlsManager->createTLS(); status = STARTING; } +Balau::Task::~Task() { + free(stack); + free(tls); +} + void Balau::Task::coroutine(void * arg) { Task * task = reinterpret_cast<Task *>(arg); Assert(task); @@ -38,7 +44,8 @@ void Balau::Task::switchTo() { tlsManager->setTLS(tls); coro_transfer(&taskMan->returnContext, &ctx); tlsManager->setTLS(oldTLS); - status = IDLE; + if (status == RUNNING) + status = IDLE; } void Balau::Task::suspend() { |