Changeset 6b224a52 for src/libcfa/concurrency/coroutine
- Timestamp:
- Aug 25, 2017, 12:11:53 PM (8 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:
- bf7b9da7
- Parents:
- 135b431 (diff), f676b84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutine
r135b431 r6b224a52 25 25 // Anything that is resumed is a coroutine. 26 26 trait is_coroutine(dtype T) { 27 void main(T *this);28 coroutine_desc * get_coroutine(T *this);27 void main(T & this); 28 coroutine_desc * get_coroutine(T & this); 29 29 }; 30 30 31 #define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X * this) { return &this->__cor; } void main(X*this)31 #define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X& this) { return &this.__cor; } void main(X& this) 32 32 33 33 //----------------------------------------------------------------------------- 34 34 // Ctors and dtors 35 void ?{}(coStack_t *this);36 void ?{}(coroutine_desc *this);37 void ?{}(coroutine_desc *this, const char * name);38 void ^?{}(coStack_t *this);39 void ^?{}(coroutine_desc *this);35 void ?{}(coStack_t & this); 36 void ?{}(coroutine_desc & this); 37 void ?{}(coroutine_desc & this, const char * name); 38 void ^?{}(coStack_t & this); 39 void ^?{}(coroutine_desc & this); 40 40 41 41 //----------------------------------------------------------------------------- … … 44 44 45 45 forall(dtype T | is_coroutine(T)) 46 static inline void resume(T *cor);46 static inline void resume(T & cor); 47 47 48 48 forall(dtype T | is_coroutine(T)) 49 void prime(T *cor);49 void prime(T & cor); 50 50 51 51 //----------------------------------------------------------------------------- … … 86 86 // Resume implementation inlined for performance 87 87 forall(dtype T | is_coroutine(T)) 88 static inline void resume(T *cor) {88 static inline void resume(T & cor) { 89 89 coroutine_desc * src = this_coroutine; // optimization 90 90 coroutine_desc * dst = get_coroutine(cor); … … 92 92 if( unlikely(!dst->stack.base) ) { 93 93 create_stack(&dst->stack, dst->stack.size); 94 CtxStart( cor, CtxInvokeCoroutine);94 CtxStart(&cor, CtxInvokeCoroutine); 95 95 } 96 96
Note:
See TracChangeset
for help on using the changeset viewer.