Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/kernel_private.h

    r82ff5845 rc81ebf9  
    2828thread_desc * nextThread(cluster * this);
    2929
    30 void BlockInternal(void);
    31 void BlockInternal(spinlock * lock);
    32 void BlockInternal(thread_desc * thrd);
    33 void BlockInternal(spinlock * lock, thread_desc * thrd);
    34 void BlockInternal(spinlock ** locks, unsigned short count);
    35 void BlockInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
     30void ScheduleInternal(void);
     31void ScheduleInternal(spinlock * lock);
     32void ScheduleInternal(thread_desc * thrd);
     33void ScheduleInternal(spinlock * lock, thread_desc * thrd);
     34void ScheduleInternal(spinlock ** locks, unsigned short count);
     35void ScheduleInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
    3636
    3737//-----------------------------------------------------------------------------
     
    6060extern thread_local processor * this_processor;
    6161
    62 extern "C" {
    63         void disable_interrupts();
    64         void enable_interrupts_noRF();
    65         void enable_interrupts();
     62static inline void disable_interrupts() {
     63        __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, 1, __ATOMIC_SEQ_CST );
     64        assert( prev != (unsigned short) -1 );
     65}
     66
     67static inline void enable_interrupts_noRF() {
     68        unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     69        assert( prev != (unsigned short) 0 );
     70}
     71
     72static inline void enable_interrupts() {
     73        unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     74        assert( prev != (unsigned short) 0 );
     75        if( prev == 1 && this_processor->pending_preemption ) {
     76                ScheduleInternal( this_processor->current_thread );
     77                this_processor->pending_preemption = false;
     78        }
    6679}
    6780
Note: See TracChangeset for help on using the changeset viewer.