Changes in src/libcfa/concurrency/kernel [025278e:6b0b624]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel
r025278e r6b0b624 26 26 //----------------------------------------------------------------------------- 27 27 // Locks 28 // Lock the spinlock, spin if already acquired 29 void lock ( spinlock * DEBUG_CTX_PARAM2 ); 30 31 // Lock the spinlock, yield repeatedly if already acquired 32 void lock_yield( spinlock * DEBUG_CTX_PARAM2 ); 33 34 // Lock the spinlock, return false if already acquired 35 bool try_lock ( spinlock * DEBUG_CTX_PARAM2 ); 36 37 // Unlock the spinlock 38 void unlock ( spinlock * ); 28 void lock ( spinlock * DEBUG_CTX_PARAM2 ); // Lock the spinlock, spin if already acquired 29 void lock_yield( spinlock * DEBUG_CTX_PARAM2 ); // Lock the spinlock, yield repeatedly if already acquired 30 bool try_lock ( spinlock * DEBUG_CTX_PARAM2 ); // Lock the spinlock, return false if already acquired 31 void unlock ( spinlock * ); // Unlock the spinlock 39 32 40 33 struct semaphore { … … 44 37 }; 45 38 46 void ?{}(semaphore &this, int count = 1);47 void ^?{}(semaphore &this);48 void P (semaphore &this);49 void V (semaphore &this);39 void ?{}(semaphore * this, int count = 1); 40 void ^?{}(semaphore * this); 41 void P(semaphore * this); 42 void V(semaphore * this); 50 43 51 44 … … 53 46 // Cluster 54 47 struct cluster { 55 // Ready queue locks 56 spinlock ready_queue_lock; 57 58 // Ready queue for threads 59 __thread_queue_t ready_queue; 60 61 // Preemption rate on this cluster 62 unsigned long long int preemption; 48 spinlock ready_queue_lock; // Ready queue locks 49 __thread_queue_t ready_queue; // Ready queue for threads 50 unsigned long long int preemption; // Preemption rate on this cluster 63 51 }; 64 52 65 void ?{} (cluster &this);66 void ^?{}(cluster &this);53 void ?{}(cluster * this); 54 void ^?{}(cluster * this); 67 55 68 56 //----------------------------------------------------------------------------- … … 80 68 unsigned short thrd_count; 81 69 }; 82 static inline void ?{}(FinishAction &this) {83 this .action_code = No_Action;84 this .thrd = NULL;85 this .lock = NULL;70 static inline void ?{}(FinishAction * this) { 71 this->action_code = No_Action; 72 this->thrd = NULL; 73 this->lock = NULL; 86 74 } 87 static inline void ^?{}(FinishAction &this) {}75 static inline void ^?{}(FinishAction * this) {} 88 76 89 77 // Processor … … 91 79 struct processor { 92 80 // Main state 93 // Coroutine ctx who does keeps the state of the processor 94 struct processorCtx_t * runner; 95 96 // Cluster from which to get threads 97 cluster * cltr; 98 99 // Handle to pthreads 100 pthread_t kernel_thread; 81 struct processorCtx_t * runner; // Coroutine ctx who does keeps the state of the processor 82 cluster * cltr; // Cluster from which to get threads 83 pthread_t kernel_thread; // Handle to pthreads 101 84 102 85 // Termination 103 // Set to true to notify the processor should terminate 104 volatile bool do_terminate; 105 106 // Termination synchronisation 107 semaphore terminated; 86 volatile bool do_terminate; // Set to true to notify the processor should terminate 87 semaphore terminated; // Termination synchronisation 108 88 109 89 // RunThread data 110 // Action to do after a thread is ran 111 struct FinishAction finish; 90 struct FinishAction finish; // Action to do after a thread is ran 112 91 113 92 // Preemption data 114 // Node which is added in the discrete event simulaiton 115 struct alarm_node_t * preemption_alarm; 116 117 // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible 118 bool pending_preemption; 93 struct alarm_node_t * preemption_alarm; // Node which is added in the discrete event simulaiton 94 bool pending_preemption; // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible 119 95 120 96 #ifdef __CFA_DEBUG__ 121 // Last function to enable preemption on this processor 122 char * last_enable; 97 char * last_enable; // Last function to enable preemption on this processor 123 98 #endif 124 99 }; 125 100 126 void ?{}(processor &this);127 void ?{}(processor &this, cluster * cltr);128 void ^?{}(processor &this);101 void ?{}(processor * this); 102 void ?{}(processor * this, cluster * cltr); 103 void ^?{}(processor * this); 129 104 130 105 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.