Ignore:
Timestamp:
May 6, 2019, 10:09:02 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
63364d8
Parents:
b9696a8
Message:

Some more work on suspend_then

File:
1 edited

Legend:

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

    rb9696a8 rf019069  
    4040                abort();
    4141        }
     42
     43        extern void CtxRet( struct __stack_context_t * to ) asm ("CtxRet") __attribute__ ((__noreturn__));
    4244}
    4345
     
    203205                CoroutineCtxSwitch( src, starter );
    204206        }
     207
     208        __attribute__((noreturn)) void __suspend_callback( struct __stack_context_t *, fptr_t call ) {
     209                call();
     210
     211                coroutine_desc * src = TL_GET( this_thread )->curr_cor;
     212                // set state of current coroutine to inactive
     213                src->state = src->state == Halted ? Halted : Inactive;
     214
     215                TL_GET( this_thread )->curr_cor = src->last;
     216
     217                // context switch to specified coroutine
     218                assert( src->last->context.SP );
     219                CtxRet( &src->last->context );
     220
     221                abort();
     222        }
    205223}
    206224
Note: See TracChangeset for help on using the changeset viewer.