- File:
-
- 1 edited
-
libcfa/src/concurrency/coroutine.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/coroutine.hfa
r1c01c58 rae7be7a 18 18 #include <assert.h> 19 19 #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) *);39 20 40 21 //----------------------------------------------------------------------------- … … 42 23 // Anything that implements this trait can be resumed. 43 24 // 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); 25 trait is_coroutine(dtype T) { 26 void main(T & this); 27 $coroutine * get_coroutine(T & this); 49 28 }; 50 29 … … 134 113 } 135 114 136 forall(dtype T | is_coroutine(T))137 void __cfaehm_cancelled_coroutine( T & cor, $coroutine * desc );138 139 115 // Resume implementation inlined for performance 140 116 forall(dtype T | is_coroutine(T)) … … 169 145 // always done for performance testing 170 146 $ctx_switch( src, dst ); 171 if ( unlikely(dst->cancellation) ) {172 __cfaehm_cancelled_coroutine( cor, dst );173 }174 147 175 148 return cor;
Note:
See TracChangeset
for help on using the changeset viewer.