summaryrefslogtreecommitdiff
path: root/src/Task.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-17 08:54:14 -0800
committerPixel <pixel@nobis-crew.org>2011-11-17 08:54:14 -0800
commite435e4bb3c0744acf5b36c6e441d309d10af1257 (patch)
treebc7bd9e8910f63bc269926be3e1f8382a8473a7f /src/Task.cc
parent250b303a9e36f1ddcb3e3b28a130a8674839a3a7 (diff)
Introducing the fact we need a more efficient stack allocator, and that it's to be performed from the task manager.
Diffstat (limited to 'src/Task.cc')
-rw-r--r--src/Task.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Task.cc b/src/Task.cc
index b512e23..d72decc 100644
--- a/src/Task.cc
+++ b/src/Task.cc
@@ -13,10 +13,18 @@ Balau::Task::Task() {
Printer::elog(E_TASK, "Created a Task at %p");
}
+bool Balau::Task::needsStacks() {
+#ifndef _WIN32
+ return true;
+#else
+ return false;
+#endif
+}
+
void Balau::Task::setup(TaskMan * taskMan) {
size_t size = stackSize();
#ifndef _WIN32
- m_stack = malloc(size);
+ m_stack = taskMan->getStack();
coro_create(&m_ctx, coroutineTrampoline, this, m_stack, size);
#else
m_stack = NULL;
@@ -34,7 +42,7 @@ void Balau::Task::setup(TaskMan * taskMan) {
Balau::Task::~Task() {
if (m_stack)
- free(m_stack);
+ m_taskMan->freeStack(m_stack);
free(m_tls);
}