Changeset b1e63ac5 for src/libcfa/concurrency/kernel_private.h
- Timestamp:
- Jul 4, 2017, 9:40:16 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 208e5be
- Parents:
- 9c951e3 (diff), f7cb0bc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/libcfa/concurrency/kernel_private.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel_private.h
r9c951e3 rb1e63ac5 21 21 #include "thread" 22 22 23 #include "alarm.h" 24 25 #include "libhdr.h" 26 23 27 //----------------------------------------------------------------------------- 24 28 // Scheduler … … 35 39 //----------------------------------------------------------------------------- 36 40 // Processor 37 structprocessorCtx_t {41 coroutine processorCtx_t { 38 42 processor * proc; 39 coroutine_desc __cor;40 43 }; 41 42 DECL_COROUTINE(processorCtx_t);43 44 44 45 void main(processorCtx_t *); … … 47 48 void finishRunning(processor * this); 48 49 void spin(processor * this, unsigned int * spin_count); 50 51 struct system_proc_t { 52 processor proc; 53 54 alarm_list_t alarms; 55 spinlock alarm_lock; 56 57 bool pending_alarm; 58 }; 59 60 extern cluster * systemCluster; 61 extern 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 } 49 82 50 83 //-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.