Changes in src/libcfa/concurrency/kernel [e15df4c:9e45e46]
- File:
-
- 1 edited
-
src/libcfa/concurrency/kernel (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel
re15df4c r9e45e46 30 30 struct cluster { 31 31 simple_thread_list ready_queue; 32 pthread_spinlock_t lock;32 // pthread_spinlock_t lock; 33 33 }; 34 34 … … 38 38 //----------------------------------------------------------------------------- 39 39 // Processor 40 enum ProcessorAction { 41 Reschedule, 42 NoAction 43 }; 44 40 45 struct processor { 41 struct processorCtx_t * ctx;46 struct processorCtx_t * runner; 42 47 cluster * cltr; 43 48 coroutine * current_coroutine; … … 46 51 simple_lock lock; 47 52 volatile bool terminated; 53 ProcessorAction thread_action; 48 54 }; 49 55 … … 62 68 void unlock( simple_lock * ); 63 69 64 struct pthread_spinlock_guard {65 pthread_spinlock_t * lock;66 };67 68 static inline void ?{}( pthread_spinlock_guard * this, pthread_spinlock_t * lock ) {69 this->lock = lock;70 pthread_spin_lock( this->lock );71 }72 73 static inline void ^?{}( pthread_spinlock_guard * this ) {74 pthread_spin_unlock( this->lock );75 }76 77 // //Simple spinlock implementation from78 // //http://stackoverflow.com/questions/1383363/is-my-spin-lock-implementation-correct-and-optimal79 // //Not optimal but correct80 // #define VOL81 82 // struct simple_spinlock {83 // VOL int lock;84 // };85 86 // extern VOL int __sync_lock_test_and_set( VOL int *, VOL int);87 // extern void __sync_synchronize();88 89 // static inline void lock( simple_spinlock * this ) {90 // while (__sync_lock_test_and_set(&this->lock, 1)) {91 // // Do nothing. This GCC builtin instruction92 // // ensures memory barrier.93 // }94 // }95 96 // static inline void unlock( simple_spinlock * this ) {97 // __sync_synchronize(); // Memory barrier.98 // this->lock = 0;99 // }100 101 70 #endif //KERNEL_H 102 71
Note:
See TracChangeset
for help on using the changeset viewer.