Ignore:
Timestamp:
Apr 26, 2017, 2:29:23 PM (4 years ago)
Author:
alain
Message:

Merge all FS related files in one single vfs directory.

File:
1 edited

Legend:

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

    r1 r11  
    5858                taken = lock->taken;
    5959
     60        // try to take the lock if not already taken
    6061                if( taken == 0 )
    6162        {
    62             // try to take the lock if not already taken
    6363                    isAtomic = hal_atomic_cas( &lock->taken , 0 , 1 );
    6464        }
     
    6969    list_add_first( &this->locks_root , &lock->list );
    7070
    71     // enable interrupts if irq_state == NULL
    72         if( irq_state ) *irq_state = mode;
    73         else            hal_restore_irq( mode );
     71    // irq_state must be restored when lock is released
     72    *irq_state = mode;
    7473}
    7574
    7675//////////////////////////////////////////////
    7776void spinlock_unlock_busy( spinlock_t * lock,
    78                            bool_t       restore,
    7977                           uint32_t     irq_state )
    8078{
     
    8684    list_unlink( &lock->list );
    8785 
    88         if( restore ) hal_restore_irq( irq_state );
     86        hal_restore_irq( irq_state );
    8987}
    9088   
     
    126124}
    127125
    128 //////////////////////////////////////////////
    129 uint32_t spinlock_trylock( spinlock_t * lock )
     126/////////////////////////////////////////////
     127error_t spinlock_trylock( spinlock_t * lock )
    130128{
    131129        uint32_t   mode;
Note: See TracChangeset for help on using the changeset viewer.