- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_subqueue.hfa
r16fd826 rf302d80 11 11 // spin lock protecting the queue 12 12 volatile bool lock; 13 14 #if !defined(__CFA_NO_STATISTICS__)15 unsigned cnt;16 #endif17 13 18 14 __thread_desc_link anchor; … … 33 29 this.anchor.next = 0p; 34 30 this.anchor.ts = 0; 35 #if !defined(__CFA_NO_STATISTICS__)36 this.cnt = 0;37 #endif38 31 39 32 // We add a boat-load of assertions here because the anchor code is very fragile 40 /* paranoid */ _Static_assert( offsetof( $thread, link ) == offsetof(__intrusive_lane_t, anchor) );41 33 /* paranoid */ verify( offsetof( $thread, link ) == offsetof(__intrusive_lane_t, anchor) ); 42 34 /* paranoid */ verify( ((uintptr_t)( mock_head(this) ) + offsetof( $thread, link )) == (uintptr_t)(&this.anchor) ); … … 62 54 // returns true of lane was empty before push, false otherwise 63 55 static inline void push( __intrusive_lane_t & this, $thread * node ) { 64 /* paranoid */ verify( this.lock );65 56 /* paranoid */ verify( node->link.next == 0p ); 66 57 /* paranoid */ verify( node->link.ts == 0 ); … … 81 72 this.prev->link.ts = rdtscl(); 82 73 this.prev = node; 83 #if !defined(__CFA_NO_STATISTICS__)84 this.cnt++;85 #endif86 74 } 87 75 … … 90 78 // returns true of lane was empty before push, false otherwise 91 79 static inline [* $thread, unsigned long long] pop( __intrusive_lane_t & this ) { 92 /* paranoid */ verify( this.lock );93 80 /* paranoid */ verify( this.anchor.next != 0p ); 94 81 /* paranoid */ verify( this.anchor.ts != 0 ); … … 102 89 node->link.next = 0p; 103 90 node->link.ts = 0; 104 #if !defined(__CFA_NO_STATISTICS__)105 this.cnt--;106 #endif107 91 108 92 // Update head time stamp … … 124 108 return this.anchor.ts; 125 109 } 110 111 // Aligned timestamps which are used by the relaxed ready queue 112 struct __attribute__((aligned(128))) __timestamp_t { 113 volatile unsigned long long tv; 114 }; 115 116 void ?{}(__timestamp_t & this) { this.tv = 0; } 117 void ^?{}(__timestamp_t & this) {}
Note: See TracChangeset
for help on using the changeset viewer.