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