Ignore:
Timestamp:
Aug 16, 2022, 2:52:24 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
71cf630
Parents:
32d1383 (diff), e116db3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r32d1383 r17c6edeb  
    305305        RUNNING:  while(true) {
    306306                thrd_dst->preempted = __NO_PREEMPTION;
    307                 thrd_dst->state = Active;
    308307
    309308                // Update global state
    310309                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;
    311315
    312316                /* paranoid */ verify( ! __preemption_enabled() );
     
    335339                /* paranoid */ verify( ! __preemption_enabled() );
    336340
    337                 // Reset global state
    338                 kernelTLS().this_thread = 0p;
    339 
    340341                // We just finished running a thread, there are a few things that could have happened.
    341342                // 1 - Regular case : the thread has blocked and now one has scheduled it yet.
     
    346347
    347348                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
    348353                        // The thread was preempted, reschedule it and reset the flag
    349354                        schedule_thread$( thrd_dst, UNPARK_LOCAL );
     
    352357
    353358                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
    354363                        // The thread has halted, it should never be scheduled/run again
    355364                        // finish the thread
     
    360369                /* paranoid */ verify( thrd_dst->state == Active );
    361370                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;
    362375
    363376                // set state of processor coroutine to active and the thread to inactive
Note: See TracChangeset for help on using the changeset viewer.