Changeset 83a071f9 for src/libcfa/concurrency/coroutine
- Timestamp:
- Aug 11, 2017, 10:10:26 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- fd344aa
- Parents:
- 8499c707
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutine
r8499c707 r83a071f9 26 26 // Anything that is resumed is a coroutine. 27 27 trait is_coroutine(dtype T) { 28 void main(T *this);29 coroutine_desc * get_coroutine(T *this);28 void main(T & this); 29 coroutine_desc * get_coroutine(T & this); 30 30 }; 31 31 32 #define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X * this) { return &this->__cor; } void main(X*this)32 #define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X& this) { return &this.__cor; } void main(X& this) 33 33 34 34 //----------------------------------------------------------------------------- … … 45 45 46 46 forall(dtype T | is_coroutine(T)) 47 static inline void resume(T *cor);47 static inline void resume(T & cor); 48 48 49 49 forall(dtype T | is_coroutine(T)) 50 void prime(T *cor);50 void prime(T & cor); 51 51 52 52 //----------------------------------------------------------------------------- … … 87 87 // Resume implementation inlined for performance 88 88 forall(dtype T | is_coroutine(T)) 89 static inline void resume(T *cor) {89 static inline void resume(T & cor) { 90 90 coroutine_desc * src = this_coroutine; // optimization 91 91 coroutine_desc * dst = get_coroutine(cor); … … 93 93 if( unlikely(!dst->stack.base) ) { 94 94 create_stack(&dst->stack, dst->stack.size); 95 CtxStart( cor, CtxInvokeCoroutine);95 CtxStart(&cor, CtxInvokeCoroutine); 96 96 } 97 97
Note: See TracChangeset
for help on using the changeset viewer.