Changeset 878cfcc for libcfa/src


Ignore:
Timestamp:
Oct 27, 2022, 10:55:20 AM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
8b74fa7
Parents:
7f81ef4
Message:

Added extra check to make sure threads is never double executed

Location:
libcfa/src/concurrency
Files:
4 edited

Legend:

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

    r7f81ef4 r878cfcc  
    214214
    215215                #if defined( __CFA_WITH_VERIFY__ )
     216                        struct processor * volatile executing;
    216217                        void * canary;
    217218                #endif
  • libcfa/src/concurrency/kernel.cfa

    r7f81ef4 r878cfcc  
    321321                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->curr_cor == proc_cor || thrd_dst->corctx_flag, "ERROR : Destination thread$ %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); // add escape condition if we are setting up the processor
    322322                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor || thrd_dst->corctx_flag, "ERROR : Destination thread$ %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor
     323                /* paranoid */ verify( __atomic_exchange_n( &thrd_dst->executing, this, __ATOMIC_SEQ_CST) == 0p );
    323324                /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary );
    324325
     
    332333
    333334                /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary );
     335                /* paranoid */ verify( __atomic_exchange_n( &thrd_dst->executing, 0p, __ATOMIC_SEQ_CST) == this );
    334336                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->corctx_flag, "ERROR : Destination thread$ %p has been corrupted.\n StackPointer too large.\n", thrd_dst );
    335337                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->corctx_flag, "ERROR : Destination thread$ %p has been corrupted.\n StackPointer too small.\n", thrd_dst );
     338                /* paranoid */ verify( thrd_dst->state != Halted );
    336339                /* paranoid */ verify( thrd_dst->context.SP );
    337                 /* paranoid */ verify( thrd_dst->curr_cluster == this->cltr );
    338340                /* paranoid */ verify( kernelTLS().this_thread == thrd_dst );
    339341                /* paranoid */ verify( ! __preemption_enabled() );
  • libcfa/src/concurrency/kernel/startup.cfa

    r7f81ef4 r878cfcc  
    529529        random_state = __global_random_mask ? __global_random_prime : __global_random_prime ^ rdtscl();
    530530        #if defined( __CFA_WITH_VERIFY__ )
     531                executing = 0p;
    531532                canary = 0x0D15EA5E0D15EA5Ep;
    532533        #endif
  • libcfa/src/concurrency/thread.cfa

    r7f81ef4 r878cfcc  
    5050        random_state = __global_random_mask ? __global_random_prime : __global_random_prime ^ rdtscl();
    5151        #if defined( __CFA_WITH_VERIFY__ )
     52                executing = 0p;
    5253                canary = 0x0D15EA5E0D15EA5Ep;
    5354        #endif
Note: See TracChangeset for help on using the changeset viewer.