Changeset 28372f7


Ignore:
Timestamp:
Oct 28, 2022, 2:57:20 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
2856982c
Parents:
22a0e87
Message:

Changed to park/unpark permit/ticketing to make sure no one unparks a dead thread

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

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

    r22a0e87 r28372f7  
    602602                /* paranoid */ verifyf( ((uintptr_t)thrd->context.SP) < ((uintptr_t)__get_stack(thrd->curr_cor)->base ), "ERROR : thread$ %p has been corrupted.\n StackPointer too small.\n", thrd );
    603603
    604                 thrd->state = Halting;
    605604                if( TICKET_RUNNING != thrd->ticket ) { abort( "Thread terminated with pending unpark" ); }
    606605                if( thrd != this->owner ) { abort( "Thread internal monitor has incorrect owner" ); }
    607606                if( this->recursion != 1) { abort( "Thread internal monitor has unbalanced recursion" ); }
     607
     608                thrd->state = Halting;
     609                thrd->ticket = TICKET_DEAD;
    608610
    609611                // Leave the thread
  • libcfa/src/concurrency/kernel/private.hfa

    r22a0e87 r28372f7  
    166166#define TICKET_RUNNING ( 0) // thread is running
    167167#define TICKET_UNBLOCK ( 1) // thread should ignore next block
     168#define TICKET_DEAD    (0xDEAD) // thread should never be unparked
    168169
    169170//-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.