Ignore:
Timestamp:
Apr 24, 2021, 11:32:49 AM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
424dfc4, 986cb99
Parents:
fec63b2 (diff), 8edbe40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    rfec63b2 r50f6afb  
    2222//-----------------------------------------------------------------------------
    2323// Exception thrown from resume when a coroutine stack is cancelled.
    24 EHM_EXCEPTION(SomeCoroutineCancelled)(
    25         void * the_coroutine;
    26         exception_t * the_exception;
    27 );
    28 
    29 EHM_EXTERN_VTABLE(SomeCoroutineCancelled, std_coroutine_cancelled);
    30 
    3124EHM_FORALL_EXCEPTION(CoroutineCancelled, (coroutine_t &), (coroutine_t)) (
    3225        coroutine_t * the_coroutine;
     
    4437// Anything that implements this trait can be resumed.
    4538// Anything that is resumed is a coroutine.
    46 trait is_coroutine(T & | IS_RESUMPTION_EXCEPTION(SomeCoroutineCancelled)) {
     39trait is_coroutine(T & | IS_RESUMPTION_EXCEPTION(CoroutineCancelled, (T))) {
    4740        void main(T & this);
    4841        $coroutine * get_coroutine(T & this);
     
    6760//-----------------------------------------------------------------------------
    6861// Public coroutine API
    69 forall(T & | is_coroutine(T))
     62forall(T & | is_coroutine(T) | { _EHM_VTABLE_TYPE(CoroutineCancelled)(T) & const _default_vtable; })
    7063void prime(T & cor);
    7164
     
    137130
    138131forall(T & | is_coroutine(T))
    139 void __cfaehm_cancelled_coroutine( T & cor, $coroutine * desc );
     132void __cfaehm_cancelled_coroutine(
     133        T & cor, $coroutine * desc, _EHM_VTABLE_TYPE(CoroutineCancelled)(T) & const _default_vtable );
    140134
    141135// Resume implementation inlined for performance
    142 forall(T & | is_coroutine(T))
     136forall(T & | is_coroutine(T) | { _EHM_VTABLE_TYPE(CoroutineCancelled)(T) & const _default_vtable; })
    143137static inline T & resume(T & cor) {
    144138        // optimization : read TLS once and reuse it
     
    170164        $ctx_switch( src, dst );
    171165        if ( unlikely(dst->cancellation) ) {
    172                 __cfaehm_cancelled_coroutine( cor, dst );
     166                __cfaehm_cancelled_coroutine( cor, dst, _default_vtable );
    173167        }
    174168
Note: See TracChangeset for help on using the changeset viewer.