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/spinlock.c

    r408 r409  
    3737{
    3838    lock->taken = 0;
     39
     40#if CONFIG_LOCKS_DEBUG
    3941    lock->owner = NULL;
    4042    list_entry_init( &lock->list );
     43#endif
     44
    4145}
    4246
     
    6670
    6771    this->local_locks++;
     72
     73#if CONFIG_LOCKS_DEBUG
    6874    lock->owner = this;
    6975    list_add_first( &this->locks_root , &lock->list );
     76#endif
    7077
    7178    // irq_state must be restored when lock is released
     
    7986    thread_t * this = CURRENT_THREAD;;
    8087
     88#if CONFIG_LOCKS_DEBUG
    8189    lock->owner = NULL;
     90    list_unlink( &lock->list );
     91#endif
     92
    8293    lock->taken = 0;
    8394    this->local_locks--;
    84     list_unlink( &lock->list );
    8595
    8696    // deschedule if pending request
     
    121131
    122132    this->local_locks++;
     133
     134#if CONFIG_LOCKS_DEBUG
    123135    lock->owner = this;
    124136    list_add_first( &this->locks_root , &lock->list );
     137#endif
    125138
    126139    // restore IRQs
     
    148161    {
    149162        this->local_locks++;
     163
     164#if CONFIG_LOCKS_DEBUG
    150165        lock->owner = this;
    151166        list_add_first( &this->locks_root , &lock->list );
     167#endif
     168
    152169        hal_restore_irq(mode);
    153170        return 0;
     
    160177    thread_t * this = CURRENT_THREAD;
    161178
     179#if CONFIG_LOCKS_DEBUG
    162180    lock->owner = NULL;
     181    list_unlink( &lock->list );
     182#endif
     183
    163184    lock->taken = 0;
    164185    this->local_locks--;
    165     list_unlink( &lock->list );
    166186
    167187    // deschedule if pending request
Note: See TracChangeset for help on using the changeset viewer.