- File:
-
- 1 edited
-
libcfa/src/concurrency/coroutine.hfa (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/coroutine.hfa
rc3b9d639 reaf269d 22 22 //----------------------------------------------------------------------------- 23 23 // Exception thrown from resume when a coroutine stack is cancelled. 24 forall(coroutine_t &) 25 exception CoroutineCancelled { 24 EHM_FORALL_EXCEPTION(CoroutineCancelled, (coroutine_t &), (coroutine_t)) ( 26 25 coroutine_t * the_coroutine; 27 26 exception_t * the_exception; 28 };27 ); 29 28 30 29 forall(T &) … … 38 37 // Anything that implements this trait can be resumed. 39 38 // Anything that is resumed is a coroutine. 40 trait is_coroutine(T & | IS_RESUMPTION_EXCEPTION(CoroutineCancelled (T))) {39 trait is_coroutine(T & | IS_RESUMPTION_EXCEPTION(CoroutineCancelled, (T))) { 41 40 void main(T & this); 42 41 coroutine$ * get_coroutine(T & this); … … 61 60 //----------------------------------------------------------------------------- 62 61 // Public coroutine API 63 forall(T & | is_coroutine(T) | { EHM_DEFAULT_VTABLE(CoroutineCancelled (T)); })62 forall(T & | is_coroutine(T) | { EHM_DEFAULT_VTABLE(CoroutineCancelled, (T)); }) 64 63 void prime(T & cor); 65 64 … … 114 113 115 114 extern void __stack_prepare( __stack_info_t * this, size_t size /* ignored if storage already allocated */); 115 extern void __stack_clean ( __stack_info_t * this ); 116 116 117 117 118 // Suspend implementation inlined for performance … … 140 141 forall(T & | is_coroutine(T)) 141 142 void __cfaehm_cancelled_coroutine( 142 T & cor, coroutine$ * desc, EHM_DEFAULT_VTABLE(CoroutineCancelled (T)) );143 T & cor, coroutine$ * desc, EHM_DEFAULT_VTABLE(CoroutineCancelled, (T)) ); 143 144 144 145 // Resume implementation inlined for performance 145 forall(T & | is_coroutine(T) | { EHM_DEFAULT_VTABLE(CoroutineCancelled (T)); })146 forall(T & | is_coroutine(T) | { EHM_DEFAULT_VTABLE(CoroutineCancelled, (T)); }) 146 147 static inline T & resume(T & cor) { 147 148 // optimization : read TLS once and reuse it
Note:
See TracChangeset
for help on using the changeset viewer.