- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel_private.h
r0c78741 rc81ebf9 21 21 #include "thread" 22 22 23 #include "alarm.h" 24 23 25 //----------------------------------------------------------------------------- 24 26 // Scheduler … … 35 37 //----------------------------------------------------------------------------- 36 38 // Processor 37 structprocessorCtx_t {39 coroutine processorCtx_t { 38 40 processor * proc; 39 coroutine_desc __cor;40 41 }; 41 42 DECL_COROUTINE(processorCtx_t);43 42 44 43 void main(processorCtx_t *); … … 47 46 void finishRunning(processor * this); 48 47 void spin(processor * this, unsigned int * spin_count); 48 49 struct system_proc_t { 50 processor proc; 51 52 alarm_list_t alarms; 53 spinlock alarm_lock; 54 55 bool pending_alarm; 56 }; 57 58 extern cluster * systemCluster; 59 extern system_proc_t * systemProcessor; 60 extern thread_local processor * this_processor; 61 62 static 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 67 static 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 72 static 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 } 79 } 49 80 50 81 //-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.