Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/coroutine.c

    r47ecf2b r4aa2fb2  
    3232#include "invoke.h"
    3333
    34 extern volatile thread_local processor * this_processor;
     34extern thread_local processor * this_processor;
    3535
    3636//-----------------------------------------------------------------------------
     
    4444// Coroutine ctors and dtors
    4545void ?{}(coStack_t* this) {
    46         this->size              = 65000;        // size of stack
     46        this->size              = 10240;        // size of stack
    4747        this->storage   = NULL; // pointer to stack
    4848        this->limit             = NULL; // stack grows towards stack limit
     
    5050        this->context   = NULL; // address of cfa_context_t
    5151        this->top               = NULL; // address of top of storage
    52         this->userStack = false;
     52        this->userStack = false;       
    5353}
    5454
     
    106106
    107107        // set state of current coroutine to inactive
    108         src->state = src->state == Halted ? Halted : Inactive;
     108        src->state = Inactive;
    109109
    110110        // set new coroutine that task is executing
    111         this_coroutine = dst;
     111        this_processor->current_coroutine = dst;
    112112
    113113        // context switch to specified coroutine
    114         assert( src->stack.context );
    115114        CtxSwitch( src->stack.context, dst->stack.context );
    116         // when CtxSwitch returns we are back in the src coroutine
     115        // when CtxSwitch returns we are back in the src coroutine             
    117116
    118117        // set state of new coroutine to active
     
    132131                this->size = libCeiling( storageSize, 16 );
    133132                // use malloc/memalign because "new" raises an exception for out-of-memory
    134 
     133               
    135134                // assume malloc has 8 byte alignment so add 8 to allow rounding up to 16 byte alignment
    136135                LIB_DEBUG_DO( this->storage = memalign( pageSize, cxtSize + this->size + pageSize ) );
Note: See TracChangeset for help on using the changeset viewer.