Ignore:
File:
1 edited

Legend:

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

    r1c01c58 rae7be7a  
    1818#include <assert.h>
    1919#include "invoke.h"
    20 #include "../exception.hfa"
    21 
    22 //-----------------------------------------------------------------------------
    23 // Exception thrown from resume when a coroutine stack is cancelled.
    24 // Should not have to be be sized (see trac #196).
    25 FORALL_DATA_EXCEPTION(CoroutineCancelled,
    26                 (dtype coroutine_t | sized(coroutine_t)), (coroutine_t)) (
    27         coroutine_t * the_coroutine;
    28         exception_t * the_exception;
    29 );
    30 
    31 forall(dtype T)
    32 void mark_exception(CoroutineCancelled(T) *);
    33 
    34 forall(dtype T | sized(T))
    35 void copy(CoroutineCancelled(T) * dst, CoroutineCancelled(T) * src);
    36 
    37 forall(dtype T)
    38 const char * msg(CoroutineCancelled(T) *);
    3920
    4021//-----------------------------------------------------------------------------
     
    4223// Anything that implements this trait can be resumed.
    4324// Anything that is resumed is a coroutine.
    44 trait is_coroutine(dtype T | sized(T)
    45                 | is_resumption_exception(CoroutineCancelled(T))
    46                 | VTABLE_ASSERTION(CoroutineCancelled, (T))) {
    47         void main(T & this);
    48         $coroutine * get_coroutine(T & this);
     25trait is_coroutine(dtype T) {
     26      void main(T & this);
     27      $coroutine * get_coroutine(T & this);
    4928};
    5029
     
    134113}
    135114
    136 forall(dtype T | is_coroutine(T))
    137 void __cfaehm_cancelled_coroutine( T & cor, $coroutine * desc );
    138 
    139115// Resume implementation inlined for performance
    140116forall(dtype T | is_coroutine(T))
     
    169145        // always done for performance testing
    170146        $ctx_switch( src, dst );
    171         if ( unlikely(dst->cancellation) ) {
    172                 __cfaehm_cancelled_coroutine( cor, dst );
    173         }
    174147
    175148        return cor;
Note: See TracChangeset for help on using the changeset viewer.