Changeset 77e6fcb
- Timestamp:
- Feb 1, 2017, 2:55:06 PM (6 years ago)
- Branches:
- aaron-thesis, arm-eh, 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:
- de90452
- Parents:
- 8761006c
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/Bench.c
r8761006c r77e6fcb 87 87 88 88 struct CoroutineDummy { coroutine c; }; 89 DECL_COROUTINE(CoroutineDummy) 89 DECL_COROUTINE(CoroutineDummy); 90 90 void main(CoroutineDummy * this) {} 91 91 … … 122 122 }; 123 123 124 DECL_COROUTINE(CoroutineResume) 124 DECL_COROUTINE(CoroutineResume); 125 125 126 126 void ?{}(CoroutineResume* this, int N) { … … 151 151 152 152 struct ThreadDummy { thread t; }; 153 DECL_THREAD(ThreadDummy) 153 DECL_THREAD(ThreadDummy); 154 154 void main(ThreadDummy * this) {} 155 155 … … 183 183 }; 184 184 185 DECL_THREAD(ContextSwitch) 185 DECL_THREAD(ContextSwitch); 186 186 187 187 void main(ContextSwitch * this) { -
src/libcfa/concurrency/coroutines
r8761006c 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 //----------------------------------------------------------------------------- … … 110 110 } 111 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 ); 128 } 129 112 130 #endif //COROUTINES_H 113 131 -
src/libcfa/concurrency/kernel.c
r8761006c r77e6fcb 43 43 }; 44 44 45 DECL_COROUTINE(processorCtx_t) 45 DECL_COROUTINE(processorCtx_t); 46 46 47 47 #define KERNEL_STORAGE(T,X) static char X##_storage[sizeof(T)] -
src/libcfa/concurrency/threads
r8761006c r77e6fcb 32 32 }; 33 33 34 #define DECL_THREAD(X) thread* get_thread(X* this) { return &this->t; } void main(X* this) ;34 #define DECL_THREAD(X) thread* get_thread(X* this) { return &this->t; } void main(X* this) 35 35 36 36 forall( dtype T | is_thread(T) ) -
src/tests/thread.c
r8761006c r77e6fcb 7 7 struct Second { thread t; simple_lock* lock; }; 8 8 9 DECL_THREAD(First) 10 DECL_THREAD(Second) 9 DECL_THREAD(First); 10 DECL_THREAD(Second); 11 11 12 12 void ?{}( First * this, simple_lock* lock ) { this->lock = lock; }
Note: See TracChangeset
for help on using the changeset viewer.