Changeset c86ee4c for libcfa/src/concurrency/ready_subqueue.hfa
- Timestamp:
- Jul 7, 2021, 6:24:42 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d83b266
- Parents:
- 1f45c7d (diff), b1a2c4a (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
-
libcfa/src/concurrency/ready_subqueue.hfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_subqueue.hfa
r1f45c7d rc86ee4c 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.