Ignore:
Timestamp:
Dec 20, 2017, 4:51:09 PM (6 years ago)
Author:
alain
Message:

Fix bugs in exec

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/rwlock.c

    r337 r409  
    3737    lock->current = 0;
    3838    lock->count   = 0;
     39
     40#if CONFIG_LOCKS_DEBUG
    3941        lock->owner   = NULL;
     42    list_entry_init( &lock->list );
     43#endif
     44
    4045}
    4146
     
    6570    this->local_locks++;
    6671
     72#if CONFIG_LOCKS_DEBUG
     73    list_add_first( &this->locks_root , &lock->list );
     74#endif
     75
    6776    // consistency
    6877    hal_fence();
     
    8897    hal_atomic_add( &lock->count , -1 );
    8998    this->local_locks--;
     99
     100#if CONFIG_LOCKS_DEBUG
     101    list_unlink( &lock->list );
     102#endif
    90103
    91104    // enable IRQs
     
    123136    }
    124137
     138    this->local_locks++;
     139
     140#if CONFIG_LOCKS_DEBUG
    125141    lock->owner = this;
    126     this->local_locks++;
     142    list_add_first( &this->locks_root , &lock->list );
     143#endif
    127144
    128145    // enable IRQs
     
    140157        hal_disable_irq( &mode );
    141158 
     159#if CONFIG_LOCKS_DEBUG
     160    lock->owner = NULL;
     161    list_unlink( &lock->list );
     162#endif
     163
    142164    // release lock
    143165    lock->current++;
    144     lock->owner = NULL;
    145166    this->local_locks--;
    146167
Note: See TracChangeset for help on using the changeset viewer.