Changeset 9b443c7f for src/libcfa/concurrency/coroutine
- Timestamp:
- Mar 15, 2017, 5:02:25 PM (7 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:
- f2e40a9f
- Parents:
- 5a3ac84 (diff), 29f44a74 (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 moved
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutine
r5a3ac84 r9b443c7f 6 6 // file "LICENCE" distributed with Cforall. 7 7 // 8 // coroutine s--8 // coroutine -- 9 9 // 10 10 // Author : Thierry Delisle … … 27 27 trait is_coroutine(dtype T) { 28 28 void main(T * this); 29 coroutine * get_coroutine(T * this);29 coroutine_desc * get_coroutine(T * this); 30 30 }; 31 31 32 #define DECL_COROUTINE(X) static inline coroutine * get_coroutine(X* this) { return &this->c; } void main(X* this)32 #define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X* this) { return &this->c; } void main(X* this) 33 33 34 34 //----------------------------------------------------------------------------- 35 35 // Ctors and dtors 36 36 void ?{}(coStack_t * this); 37 void ?{}(coroutine * this);38 void ?{}(coroutine * this, const char * name);37 void ?{}(coroutine_desc * this); 38 void ?{}(coroutine_desc * this, const char * name); 39 39 void ^?{}(coStack_t * this); 40 void ^?{}(coroutine * this);40 void ^?{}(coroutine_desc * this); 41 41 42 42 //----------------------------------------------------------------------------- … … 63 63 64 64 // Get current coroutine 65 coroutine * this_coroutine(void);65 coroutine_desc * this_coroutine(void); 66 66 67 67 // Private wrappers for context switch and stack creation 68 extern void CoroutineCtxSwitch(coroutine * src, coroutine* dst);68 extern void CoroutineCtxSwitch(coroutine_desc * src, coroutine_desc * dst); 69 69 extern void create_stack( coStack_t * this, unsigned int storageSize ); 70 70 71 71 // Suspend implementation inlined for performance 72 72 static inline void suspend() { 73 coroutine * src = this_coroutine(); // optimization73 coroutine_desc * src = this_coroutine(); // optimization 74 74 75 75 assertf( src->last != 0, … … 88 88 forall(dtype T | is_coroutine(T)) 89 89 static inline void resume(T * cor) { 90 coroutine * src = this_coroutine(); // optimization91 coroutine * dst = get_coroutine(cor);90 coroutine_desc * src = this_coroutine(); // optimization 91 coroutine_desc * dst = get_coroutine(cor); 92 92 93 93 if( unlikely(!dst->stack.base) ) { … … 111 111 } 112 112 113 static inline void resume(coroutine * dst) {114 coroutine * src = this_coroutine(); // optimization113 static inline void resume(coroutine_desc * dst) { 114 coroutine_desc * src = this_coroutine(); // optimization 115 115 116 116 // not resuming self ?
Note: See TracChangeset
for help on using the changeset viewer.