Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.cfa

    r8bee858 rced5e2a  
    305305        RUNNING:  while(true) {
    306306                thrd_dst->preempted = __NO_PREEMPTION;
     307                thrd_dst->state = Active;
    307308
    308309                // Update global state
    309310                kernelTLS().this_thread = thrd_dst;
    310 
    311                 // Update the state after setting this_thread
    312                 // so that the debugger can find all active threads
    313                 // in tls storage
    314                 thrd_dst->state = Active;
    315311
    316312                /* paranoid */ verify( ! __preemption_enabled() );
     
    339335                /* paranoid */ verify( ! __preemption_enabled() );
    340336
     337                // Reset global state
     338                kernelTLS().this_thread = 0p;
     339
    341340                // We just finished running a thread, there are a few things that could have happened.
    342341                // 1 - Regular case : the thread has blocked and now one has scheduled it yet.
     
    347346
    348347                if(unlikely(thrd_dst->preempted != __NO_PREEMPTION)) {
    349                         // Reset the this_thread now that we know
    350                         // the state isn't active anymore
    351                         kernelTLS().this_thread = 0p;
    352 
    353348                        // The thread was preempted, reschedule it and reset the flag
    354349                        schedule_thread$( thrd_dst, UNPARK_LOCAL );
     
    357352
    358353                if(unlikely(thrd_dst->state == Halting)) {
    359                         // Reset the this_thread now that we know
    360                         // the state isn't active anymore
    361                         kernelTLS().this_thread = 0p;
    362 
    363354                        // The thread has halted, it should never be scheduled/run again
    364355                        // finish the thread
     
    369360                /* paranoid */ verify( thrd_dst->state == Active );
    370361                thrd_dst->state = Blocked;
    371 
    372                 // Reset the this_thread now that we know
    373                 // the state isn't active anymore
    374                 kernelTLS().this_thread = 0p;
    375362
    376363                // set state of processor coroutine to active and the thread to inactive
Note: See TracChangeset for help on using the changeset viewer.