From 1548da7eb85e8199e49c0a4e7e3c53fb2184177e Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 8 Apr 2012 16:33:53 -0700 Subject: Few more quirks into the stackless mode; we don't want to allocate stacks nor create any co-routine (or fiber) if we're stackless. --- src/Task.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/Task.cc') diff --git a/src/Task.cc b/src/Task.cc index 5026d28..52e9fa2 100644 --- a/src/Task.cc +++ b/src/Task.cc @@ -19,16 +19,21 @@ bool Balau::Task::needsStacks() { } void Balau::Task::setup(TaskMan * taskMan, void * stack) { - size_t size = stackSize(); + if (m_stackless) { + IAssert(!stack, "Since we're stackless, no stack should've been allocated."); + m_stack = NULL; + } else { + size_t size = stackSize(); #ifndef _WIN32 - IAssert(stack, "Can't setup a coroutine without a stack"); - m_stack = stack; - coro_create(&m_ctx, coroutineTrampoline, this, m_stack, size); + IAssert(stack, "Can't setup a coroutine without a stack"); + m_stack = stack; + coro_create(&m_ctx, coroutineTrampoline, this, m_stack, size); #else - Assert(!stack, "We shouldn't allocate stacks with Fibers"); - m_stack = NULL; - m_fiber = CreateFiber(size, coroutineTrampoline, this); + Assert(!stack, "We shouldn't allocate stacks with Fibers"); + m_stack = NULL; + m_fiber = CreateFiber(size, coroutineTrampoline, this); #endif + } m_taskMan = taskMan; -- cgit v1.2.3