Ignore:
File:
1 edited

Legend:

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

    rb158d8f r2e9aed4  
    242242void finishRunning(processor * this) {
    243243        if( this->finish.action_code == Release ) {
     244                verify( disable_preempt_count > 1 );
    244245                unlock( *this->finish.lock );
    245246        }
     
    248249        }
    249250        else if( this->finish.action_code == Release_Schedule ) {
     251                verify( disable_preempt_count > 1 );
    250252                unlock( *this->finish.lock );
    251253                ScheduleThread( this->finish.thrd );
    252254        }
    253255        else if( this->finish.action_code == Release_Multi ) {
     256                verify( disable_preempt_count > this->finish.lock_count );
    254257                for(int i = 0; i < this->finish.lock_count; i++) {
    255258                        unlock( *this->finish.locks[i] );
     
    257260        }
    258261        else if( this->finish.action_code == Release_Multi_Schedule ) {
     262                verify( disable_preempt_count > this->finish.lock_count );
    259263                for(int i = 0; i < this->finish.lock_count; i++) {
    260264                        unlock( *this->finish.locks[i] );
     
    363367        this_processor->finish.lock = lock;
    364368
    365         verify( disable_preempt_count > 0 );
     369        verify( disable_preempt_count > 1 );
    366370        suspend();
    367371        verify( disable_preempt_count > 0 );
     
    391395        this_processor->finish.thrd = thrd;
    392396
    393         verify( disable_preempt_count > 0 );
     397        verify( disable_preempt_count > 1 );
    394398        suspend();
    395399        verify( disable_preempt_count > 0 );
     
    516520}
    517521
     522//=============================================================================================
     523// Unexpected Terminating logic
     524//=============================================================================================
     525
     526
    518527static __spinlock_t kernel_abort_lock;
    519528static __spinlock_t kernel_debug_lock;
     
    611620}
    612621
     622//-----------------------------------------------------------------------------
     623// Debug
     624__cfaabi_dbg_debug_do(
     625        struct {
     626                thread_desc * tail;
     627        } __cfaabi_dbg_thread_list = { NULL };
     628
     629        void __cfaabi_dbg_thread_register( thread_desc * thrd ) {
     630                if( !__cfaabi_dbg_thread_list.tail ) {
     631                        __cfaabi_dbg_thread_list.tail = thrd;
     632                        return;
     633                }
     634                __cfaabi_dbg_thread_list.tail->dbg_next = thrd;
     635                thrd->dbg_prev = __cfaabi_dbg_thread_list.tail;
     636                __cfaabi_dbg_thread_list.tail = thrd;
     637        }
     638
     639        void __cfaabi_dbg_thread_unregister( thread_desc * thrd ) {
     640                thread_desc * prev = thrd->dbg_prev;
     641                thread_desc * next = thrd->dbg_next;
     642
     643                if( next ) { next->dbg_prev = prev; }
     644                else       {
     645                        assert( __cfaabi_dbg_thread_list.tail == thrd );
     646                        __cfaabi_dbg_thread_list.tail = prev;
     647                }
     648
     649                if( prev ) { prev->dbg_next = next; }
     650
     651                thrd->dbg_prev = NULL;
     652                thrd->dbg_next = NULL;
     653        }
     654)
    613655// Local Variables: //
    614656// mode: c //
Note: See TracChangeset for help on using the changeset viewer.