Ignore:
File:
1 edited

Legend:

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

    r4aa2fb2 r1c273d0  
    2727//-----------------------------------------------------------------------------
    2828// Scheduler
     29
     30extern "C" {
     31        void disable_interrupts();
     32        void enable_interrupts_noRF();
     33        void enable_interrupts( const char * );
     34}
     35
    2936void ScheduleThread( thread_desc * );
     37static inline void WakeThread( thread_desc * thrd ) {
     38        if( !thrd ) return;
     39
     40        disable_interrupts();
     41        ScheduleThread( thrd );
     42        enable_interrupts( __PRETTY_FUNCTION__ );
     43}
    3044thread_desc * nextThread(cluster * this);
    3145
    32 void ScheduleInternal(void);
    33 void ScheduleInternal(spinlock * lock);
    34 void ScheduleInternal(thread_desc * thrd);
    35 void ScheduleInternal(spinlock * lock, thread_desc * thrd);
    36 void ScheduleInternal(spinlock ** locks, unsigned short count);
    37 void ScheduleInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
     46void BlockInternal(void);
     47void BlockInternal(spinlock * lock);
     48void BlockInternal(thread_desc * thrd);
     49void BlockInternal(spinlock * lock, thread_desc * thrd);
     50void BlockInternal(spinlock ** locks, unsigned short count);
     51void BlockInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
    3852
    3953//-----------------------------------------------------------------------------
     
    6074extern cluster * systemCluster;
    6175extern system_proc_t * systemProcessor;
    62 extern thread_local processor * this_processor;
    63 
    64 static inline void disable_interrupts() {
    65         __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, 1, __ATOMIC_SEQ_CST );
    66         assert( prev != (unsigned short) -1 );
    67 }
    68 
    69 static inline void enable_interrupts_noRF() {
    70         __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    71         verify( prev != (unsigned short) 0 );
    72 }
    73 
    74 static inline void enable_interrupts() {
    75         __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    76         verify( prev != (unsigned short) 0 );
    77         if( prev == 1 && this_processor->pending_preemption ) {
    78                 ScheduleInternal( this_processor->current_thread );
    79                 this_processor->pending_preemption = false;
    80         }
    81 }
     76extern volatile thread_local processor * this_processor;
     77extern volatile thread_local coroutine_desc * this_coroutine;
     78extern volatile thread_local thread_desc * this_thread;
     79extern volatile thread_local unsigned short disable_preempt_count;
    8280
    8381//-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.