- File:
-
- 1 edited
-
src/libcfa/concurrency/coroutines (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutines
r8def349 r77e6fcb 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* get_coroutine(X* this) { return &this->c; } void main(X* this) 33 33 34 34 //----------------------------------------------------------------------------- … … 65 65 66 66 // Private wrappers for context switch and stack creation 67 extern void corCxtSw(coroutine * src, coroutine * dst);67 extern void CoroutineCtxSwitch(coroutine * src, coroutine * dst); 68 68 extern void create_stack( coStack_t * this, unsigned int storageSize ); 69 69 … … 81 81 src->name, src, src->last->name, src->last ); 82 82 83 corCxtSw( src, src->last );83 CoroutineCtxSwitch( src, src->last ); 84 84 } 85 85 … … 107 107 108 108 // always done for performance testing 109 corCxtSw( src, dst ); 109 CoroutineCtxSwitch( src, dst ); 110 } 111 112 static inline void resume(coroutine * dst) { 113 coroutine * src = this_coroutine(); // optimization 114 115 // not resuming self ? 116 if ( src != dst ) { 117 assertf( dst->notHalted , 118 "Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n" 119 "Possible cause is terminated coroutine's main routine has already returned.", 120 src->name, src, dst->name, dst ); 121 122 // set last resumer 123 dst->last = src; 124 } // if 125 126 // always done for performance testing 127 CoroutineCtxSwitch( src, dst ); 110 128 } 111 129
Note:
See TracChangeset
for help on using the changeset viewer.