- File:
-
- 1 edited
-
libcfa/src/concurrency/ready_subqueue.hfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_subqueue.hfa
re84ab3d ref94ae7 7 7 // Intrusives lanes which are used by the relaxed ready queue 8 8 struct __attribute__((aligned(128))) __intrusive_lane_t { 9 struct thread$* prev;9 struct $thread * prev; 10 10 11 11 // spin lock protecting the queue … … 20 20 21 21 // Get the head pointer (one before the first element) from the anchor 22 static inline thread$* mock_head(const __intrusive_lane_t & this) {23 thread$ * rhead = (thread$*)(24 (uintptr_t)( &this.anchor ) - __builtin_offsetof( thread$, link )22 static inline $thread * mock_head(const __intrusive_lane_t & this) { 23 $thread * rhead = ($thread *)( 24 (uintptr_t)( &this.anchor ) - __builtin_offsetof( $thread, link ) 25 25 ); 26 26 return rhead; … … 38 38 39 39 // 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 /* paranoid */ verify( offsetof( thread$, link ) == offsetof(__intrusive_lane_t, anchor) );42 /* paranoid */ verify( ((uintptr_t)( mock_head(this) ) + offsetof( thread$, link )) == (uintptr_t)(&this.anchor) );40 /* paranoid */ _Static_assert( offsetof( $thread, link ) == offsetof(__intrusive_lane_t, anchor) ); 41 /* paranoid */ verify( offsetof( $thread, link ) == offsetof(__intrusive_lane_t, anchor) ); 42 /* paranoid */ verify( ((uintptr_t)( mock_head(this) ) + offsetof( $thread, link )) == (uintptr_t)(&this.anchor) ); 43 43 /* paranoid */ verify( &mock_head(this)->link.next == &this.anchor.next ); 44 44 /* paranoid */ verify( &mock_head(this)->link.ts == &this.anchor.ts ); … … 61 61 // Push a thread onto this lane 62 62 // returns true of lane was empty before push, false otherwise 63 static inline void push( __intrusive_lane_t & this, thread$* node ) {63 static inline void push( __intrusive_lane_t & this, $thread * node ) { 64 64 /* paranoid */ verify( this.lock ); 65 65 /* paranoid */ verify( node->link.next == 0p ); … … 91 91 // returns popped 92 92 // returns true of lane was empty before push, false otherwise 93 static inline [* thread$, unsigned long long] pop( __intrusive_lane_t & this ) {93 static inline [* $thread, unsigned long long] pop( __intrusive_lane_t & this ) { 94 94 /* paranoid */ verify( this.lock ); 95 95 /* paranoid */ verify( this.anchor.next != 0p ); … … 99 99 // Get the relevant nodes locally 100 100 unsigned long long ts = this.anchor.ts; 101 thread$* node = this.anchor.next;101 $thread * node = this.anchor.next; 102 102 this.anchor.next = node->link.next; 103 103 this.anchor.ts = node->link.ts;
Note:
See TracChangeset
for help on using the changeset viewer.