Changes in / [5f95b5f:6bfe5cc]


Ignore:
Location:
src
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/invoke.h

    r5f95b5f r6bfe5cc  
    121121                // coroutine body used to store context
    122122                struct coroutine_desc  self_cor;
    123 
    124                 // current active context
    125                 struct coroutine_desc * curr_cor;
    126123
    127124                // monitor body used for mutual exclusion
  • src/libcfa/concurrency/kernel.c

    r5f95b5f r6bfe5cc  
    108108void ?{}( thread_desc & this, current_stack_info_t * info) with( this ) {
    109109        self_cor{ info };
    110         curr_cor = &self_cor;
    111         self_mon.owner = &this;
    112         self_mon.recursion = 1;
    113         self_mon_p = &self_mon;
    114         next = NULL;
    115         __cfaabi_dbg_debug_do(
    116                 dbg_next = NULL;
    117                 dbg_prev = NULL;
    118                 __cfaabi_dbg_thread_register(&this);
    119         )
    120 
    121         monitors{ &self_mon_p, 1, (fptr_t)0 };
    122110}
    123111
     
    237225// from the processor coroutine to the target thread
    238226void runThread(processor * this, thread_desc * dst) {
    239         assert(dst->curr_cor);
    240227        coroutine_desc * proc_cor = get_coroutine(*this->runner);
    241         coroutine_desc * thrd_cor = dst->curr_cor;
     228        coroutine_desc * thrd_cor = get_coroutine(dst);
    242229
    243230        //Reset the terminating actions here
     
    250237        ThreadCtxSwitch(proc_cor, thrd_cor);
    251238        // when ThreadCtxSwitch returns we are back in the processor coroutine
    252 }
    253 
    254 void returnToKernel() {
    255         coroutine_desc * proc_cor = get_coroutine(*this_processor->runner);
    256         coroutine_desc * thrd_cor = this_thread->curr_cor = this_coroutine;
    257         ThreadCtxSwitch(thrd_cor, proc_cor);
    258239}
    259240
     
    379360        disable_interrupts();
    380361        verify( !preemption_enabled );
    381         returnToKernel();
     362        suspend();
    382363        verify( !preemption_enabled );
    383364        enable_interrupts( __cfaabi_dbg_ctx );
     
    390371
    391372        verify( !preemption_enabled );
    392         returnToKernel();
     373        suspend();
    393374        verify( !preemption_enabled );
    394375
     
    402383
    403384        verify( !preemption_enabled );
    404         returnToKernel();
     385        suspend();
    405386        verify( !preemption_enabled );
    406387
     
    416397
    417398        verify( !preemption_enabled );
    418         returnToKernel();
     399        suspend();
    419400        verify( !preemption_enabled );
    420401
     
    429410
    430411        verify( !preemption_enabled );
    431         returnToKernel();
     412        suspend();
    432413        verify( !preemption_enabled );
    433414
     
    444425
    445426        verify( !preemption_enabled );
    446         returnToKernel();
     427        suspend();
    447428        verify( !preemption_enabled );
    448429
     
    456437        this_processor->finish.thrd        = thrd;
    457438
    458         returnToKernel();
     439        suspend();
    459440}
    460441
     
    521502        // which is currently here
    522503        mainProcessor->do_terminate = true;
    523         returnToKernel();
     504        suspend();
    524505
    525506        // THE SYSTEM IS NOW COMPLETELY STOPPED
  • src/libcfa/concurrency/thread.c

    r5f95b5f r6bfe5cc  
    3434        self_cor{};
    3535        self_cor.name = "Anonymous Coroutine";
    36         curr_cor = &self_cor;
    3736        self_mon.owner = &this;
    3837        self_mon.recursion = 1;
     
    105104        dst->state = Active;
    106105
     106        //update the last resumer
     107        dst->last = src;
     108
    107109        // set new coroutine that the processor is executing
    108110        // and context switch to it
Note: See TracChangeset for help on using the changeset viewer.