Ignore:
Timestamp:
Apr 15, 2019, 4:06:40 PM (3 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
deca0f5
Parents:
5c1a531
Message:

Inlined coroutine context switch routine

File:
1 edited

Legend:

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

    r5c1a531 r3c06bba  
    124124}
    125125
    126 // Wrapper for co
    127 void CoroutineCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
    128         // set state of current coroutine to inactive
    129         src->state = src->state == Halted ? Halted : Inactive;
    130 
    131         // set new coroutine that task is executing
    132         TL_GET( this_thread )->curr_cor = dst;
    133 
    134         // context switch to specified coroutine
    135         verify( dst->context.SP );
    136         CtxSwitch( &src->context, &dst->context );
    137         // when CtxSwitch returns we are back in the src coroutine
    138 
    139         // set state of new coroutine to active
    140         src->state = Active;
    141 
    142         if( unlikely(src->cancellation != NULL) ) {
    143                 _CtxCoroutine_Unwind(src->cancellation, src);
    144         }
    145 }
    146 
    147126[void *, size_t] __stack_alloc( size_t storageSize ) {
    148127        static const size_t stack_data_size = libCeiling( sizeof(__stack_t), 16 ); // minimum alignment
Note: See TracChangeset for help on using the changeset viewer.