Ignore:
Timestamp:
Jun 29, 2017, 11:59:09 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
b751c8e
Parents:
7bbba76
Message:

Commented some debug messages.
Monitors now yield when spinning.
Debug mode saves more information about previous locks and interrupts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/preemption.c

    r7bbba76 rb227f68  
    158158//=============================================================================================
    159159
     160LIB_DEBUG_DO( static thread_local void * last_interrupt = 0; )
     161
    160162extern "C" {
    161163        void disable_interrupts() {
     
    187189
    188190static inline void signal_unblock( int sig ) {
    189         LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p unblocking sig %i\n", this_processor, sig );
     191        // LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p unblocking sig %i\n", this_processor, sig );
     192
     193        // LIB_DEBUG_DO(
     194        //      sigset_t waiting;
     195        //      sigemptyset(&waiting);
     196        //      sigpending(&waiting);
     197        //      verify( !sigismember(&waiting, sig) );
     198        // )
    190199
    191200        sigset_t mask;
     
    217226
    218227void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
    219         LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Ctx Switch IRH %p running %p @ %p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) );
     228        LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "CtxSw IRH %10p running %10p @ %10p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) );
     229        LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[REG_RIP]); )
    220230
    221231        if( preemption_ready() ) {
    222                 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Blocking thread %p on %p\n", this_thread, this_processor );
     232                // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Blocking thread %p on %p\n", this_thread, this_processor );
    223233                signal_unblock( SIGUSR1 );
    224234                BlockInternal( (thread_desc*)this_thread );
    225                 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Back\n\n");
     235                // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Back\n\n");
    226236        }
    227237        else {
    228                 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Defering\n" );
     238                // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ctx Switch IRH : Defering\n" );
    229239                defer_ctxSwitch();
    230240                signal_unblock( SIGUSR1 );
     
    233243
    234244void sigHandler_alarm( __CFA_SIGPARMS__ ) {
    235         LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "\nAlarm IRH %p running %p @ %p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) );
    236 
    237         // if( ((intptr_t)cxt->uc_mcontext.gregs[REG_RIP]) > 0xFFFFFF ) __debug_break();
     245        LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "\nAlarm IRH %10p running %10p @ %10p\n", this_processor, this_thread, (void *)(cxt->uc_mcontext.gregs[REG_RIP]) );
     246        LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[REG_RIP]); )
    238247
    239248        if( try_lock( &systemProcessor->alarm_lock DEBUG_CTX2 ) ) {
     
    248257
    249258        if( preemption_ready() && this_processor->pending_preemption ) {
    250                 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm IRH : Blocking thread %p on %p\n", this_thread, this_processor );
     259                // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm IRH : Blocking thread %p on %p\n", this_thread, this_processor );
    251260                this_processor->pending_preemption = false;
    252261                BlockInternal( (thread_desc*)this_thread );
    253                 LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm Switch IRH : Back\n\n");
     262                // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Alarm Switch IRH : Back\n\n");
    254263        }
    255264}
Note: See TracChangeset for help on using the changeset viewer.