Changeset 89a3df5 for src/libcfa
- Timestamp:
- Mar 15, 2017, 3:59:09 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:
- 0e7b95c
- Parents:
- 0ea1b65
- Location:
- src/libcfa/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutine.c
r0ea1b65 r89a3df5 32 32 #include "invoke.h" 33 33 34 extern processor * get_this_processor();34 extern thread_local processor * this_processor; 35 35 36 36 //----------------------------------------------------------------------------- … … 109 109 110 110 // set new coroutine that task is executing 111 get_this_processor()->current_coroutine = dst;111 this_processor->current_coroutine = dst; 112 112 113 113 // context switch to specified coroutine -
src/libcfa/concurrency/kernel.c
r0ea1b65 r89a3df5 55 55 thread_local processor * this_processor; 56 56 57 processor * get_this_processor() {58 return this_processor;59 }60 61 57 coroutine * this_coroutine(void) { 62 58 return this_processor->current_coroutine; … … 317 313 318 314 void ScheduleInternal( spinlock * lock ) { 319 get_this_processor()->finish.action_code = Release;320 get_this_processor()->finish.lock = lock;315 this_processor->finish.action_code = Release; 316 this_processor->finish.lock = lock; 321 317 suspend(); 322 318 } 323 319 324 320 void ScheduleInternal( thread * thrd ) { 325 get_this_processor()->finish.action_code = Schedule;326 get_this_processor()->finish.thrd = thrd;321 this_processor->finish.action_code = Schedule; 322 this_processor->finish.thrd = thrd; 327 323 suspend(); 328 324 } 329 325 330 326 void ScheduleInternal( spinlock * lock, thread * thrd ) { 331 get_this_processor()->finish.action_code = Release_Schedule;332 get_this_processor()->finish.lock = lock;333 get_this_processor()->finish.thrd = thrd;327 this_processor->finish.action_code = Release_Schedule; 328 this_processor->finish.lock = lock; 329 this_processor->finish.thrd = thrd; 334 330 suspend(); 335 331 } -
src/libcfa/concurrency/thread.c
r0ea1b65 r89a3df5 28 28 } 29 29 30 extern processor * get_this_processor();30 extern thread_local processor * this_processor; 31 31 32 32 //----------------------------------------------------------------------------- … … 77 77 thread* thrd_h = get_thread (this); 78 78 thrd_c->last = this_coroutine(); 79 get_this_processor()->current_coroutine = thrd_c;79 this_processor->current_coroutine = thrd_c; 80 80 81 81 LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h); … … 94 94 95 95 void yield( void ) { 96 ScheduleInternal( get_this_processor()->current_thread );96 ScheduleInternal( this_processor->current_thread ); 97 97 } 98 98 … … 107 107 // set new coroutine that the processor is executing 108 108 // and context switch to it 109 get_this_processor()->current_coroutine = dst;109 this_processor->current_coroutine = dst; 110 110 CtxSwitch( src->stack.context, dst->stack.context ); 111 get_this_processor()->current_coroutine = src;111 this_processor->current_coroutine = src; 112 112 113 113 // set state of new coroutine to active
Note: See TracChangeset
for help on using the changeset viewer.