Changes in src/libcfa/concurrency/thread.c [1c273d0:44264c5]
- File:
-
- 1 edited
-
src/libcfa/concurrency/thread.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/thread.c
r1c273d0 r44264c5 28 28 } 29 29 30 extern volatilethread_local processor * this_processor;30 extern thread_local processor * this_processor; 31 31 32 32 //----------------------------------------------------------------------------- … … 71 71 coroutine_desc* thrd_c = get_coroutine(this); 72 72 thread_desc* thrd_h = get_thread (this); 73 thrd_c->last = this_coroutine; 73 thrd_c->last = this_coroutine(); 74 this_processor->current_coroutine = thrd_c; 74 75 75 //LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);76 LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h); 76 77 77 disable_interrupts();78 78 create_stack(&thrd_c->stack, thrd_c->stack.size); 79 this_coroutine = thrd_c;80 79 CtxStart(this, CtxInvokeThread); 81 assert( thrd_c->last->stack.context );82 80 CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context ); 83 81 84 82 ScheduleThread(thrd_h); 85 enable_interrupts( __PRETTY_FUNCTION__ );86 83 } 87 84 88 85 void yield( void ) { 89 BlockInternal( (thread_desc *)this_thread );86 ScheduleInternal( this_processor->current_thread ); 90 87 } 91 88 … … 98 95 void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) { 99 96 // set state of current coroutine to inactive 100 src->state = src->state == Halted ? Halted :Inactive;97 src->state = Inactive; 101 98 dst->state = Active; 102 99 … … 106 103 // set new coroutine that the processor is executing 107 104 // and context switch to it 108 this_coroutine = dst; 109 assert( src->stack.context ); 105 this_processor->current_coroutine = dst; 110 106 CtxSwitch( src->stack.context, dst->stack.context ); 111 this_ coroutine = src;107 this_processor->current_coroutine = src; 112 108 113 109 // set state of new coroutine to active 114 dst->state = dst->state == Halted ? Halted :Inactive;110 dst->state = Inactive; 115 111 src->state = Active; 116 112 }
Note:
See TracChangeset
for help on using the changeset viewer.