Changeset 2e9b59b for libcfa/src/concurrency/ready_subqueue.hfa
- Timestamp:
- Apr 19, 2022, 3:00:04 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 5b84a321
- Parents:
- ba897d21 (diff), bb7c77d (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
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_subqueue.hfa
rba897d21 r2e9b59b 3 3 #define __CFA_NO_SCHED_STATS__ 4 4 5 #include " containers/queueLockFree.hfa"5 #include "limits.hfa" 6 6 7 7 // Intrusives lanes which are used by the relaxed ready queue … … 27 27 } 28 28 29 // Ctor30 void ?{}( __intrusive_lane_t & this ) {31 this.lock = false;32 this.prev = mock_head(this);33 this.anchor.next = 0p;34 this.anchor.ts = -1llu;35 #if !defined(__CFA_NO_STATISTICS__)36 this.cnt = 0;37 #endif38 39 // We add a boat-load of assertions here because the anchor code is very fragile40 /* 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 /* paranoid */ verify( &mock_head(this)->link.next == &this.anchor.next );44 /* paranoid */ verify( &mock_head(this)->link.ts == &this.anchor.ts );45 /* paranoid */ verify( mock_head(this)->link.next == 0p );46 /* paranoid */ verify( mock_head(this)->link.ts == -1llu );47 /* paranoid */ verify( mock_head(this) == this.prev );48 /* paranoid */ verify( __alignof__(__intrusive_lane_t) == 128 );49 /* paranoid */ verify( __alignof__(this) == 128 );50 /* paranoid */ verifyf( ((intptr_t)(&this) % 128) == 0, "Expected address to be aligned %p %% 128 == %zd", &this, ((intptr_t)(&this) % 128) );51 }52 53 // Dtor is trivial54 void ^?{}( __intrusive_lane_t & this ) {55 // Make sure the list is empty56 /* paranoid */ verify( this.anchor.next == 0p );57 /* paranoid */ verify( this.anchor.ts == -1llu );58 /* paranoid */ verify( mock_head(this) == this.prev );59 }60 61 29 // Push a thread onto this lane 62 30 // returns true of lane was empty before push, false otherwise … … 64 32 /* paranoid */ verify( this.lock ); 65 33 /* paranoid */ verify( node->link.next == 0p ); 66 /* paranoid */ verify( node->link.ts == -1llu);34 /* paranoid */ verify( node->link.ts == MAX ); 67 35 /* paranoid */ verify( this.prev->link.next == 0p ); 68 /* paranoid */ verify( this.prev->link.ts == -1llu);36 /* paranoid */ verify( this.prev->link.ts == MAX ); 69 37 if( this.anchor.next == 0p ) { 70 38 /* paranoid */ verify( this.anchor.next == 0p ); 71 /* paranoid */ verify( this.anchor.ts == -1llu);39 /* paranoid */ verify( this.anchor.ts == MAX ); 72 40 /* paranoid */ verify( this.anchor.ts != 0 ); 73 41 /* paranoid */ verify( this.prev == mock_head( this ) ); 74 42 } else { 75 43 /* paranoid */ verify( this.anchor.next != 0p ); 76 /* paranoid */ verify( this.anchor.ts != -1llu);44 /* paranoid */ verify( this.anchor.ts != MAX ); 77 45 /* paranoid */ verify( this.anchor.ts != 0 ); 78 46 /* paranoid */ verify( this.prev != mock_head( this ) ); … … 94 62 /* paranoid */ verify( this.lock ); 95 63 /* paranoid */ verify( this.anchor.next != 0p ); 96 /* paranoid */ verify( this.anchor.ts != -1llu);64 /* paranoid */ verify( this.anchor.ts != MAX ); 97 65 /* paranoid */ verify( this.anchor.ts != 0 ); 98 66 … … 103 71 bool is_empty = this.anchor.next == 0p; 104 72 node->link.next = 0p; 105 node->link.ts = -1llu;73 node->link.ts = MAX; 106 74 #if !defined(__CFA_NO_STATISTICS__) 107 75 this.cnt--; … … 112 80 113 81 /* paranoid */ verify( node->link.next == 0p ); 114 /* paranoid */ verify( node->link.ts == -1llu);82 /* paranoid */ verify( node->link.ts == MAX ); 115 83 /* paranoid */ verify( node->link.ts != 0 ); 116 84 /* paranoid */ verify( this.anchor.ts != 0 );
Note:
See TracChangeset
for help on using the changeset viewer.