Ignore:
Timestamp:
Aug 7, 2017, 12:50:17 PM (7 years ago)
Author:
alain
Message:

Introduce the delayed context switch if current thread has a lock.

File:
1 edited

Legend:

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

    r296 r337  
    141141
    142142        hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , XPTR_NULL );
    143 
    144143        hal_remote_sw ( XPTR( lock_cxy , &lock_ptr->taken ) , 0 );
    145 
    146144        thread_ptr->remote_locks--;
    147 
    148145        xlist_unlink( XPTR( lock_cxy , &lock_ptr->list ) );
    149146
     147    // deschedule if pending request
     148    thread_check_sched();
     149 
     150    // restore IRQs
    150151        hal_restore_irq( irq_state );
    151152}
     
    211212
    212213        hal_remote_swd( XPTR( lock_cxy , &lock_ptr->owner ) , XPTR_NULL );
    213 
    214214        hal_remote_sw ( XPTR( lock_cxy , &lock_ptr->taken ) , 0 );
    215 
    216215        thread_ptr->remote_locks--;
    217 
    218216        xlist_unlink( XPTR( lock_cxy , &lock_ptr->list ) );
     217
     218    // deschedule if pending request
     219    thread_check_sched();
    219220}
    220221
Note: See TracChangeset for help on using the changeset viewer.