Changeset 5024df4
- Timestamp:
- May 25, 2022, 3:41:58 PM (13 months ago)
- Branches:
- ADT, master, pthread-emulation, qualifiedEnum
- Children:
- c715e5f
- Parents:
- b035046
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/cluster.cfa
rb035046 r5024df4 484 484 /* paranoid */ verify( &mock_head(this)->link.ts == &this.anchor.ts ); 485 485 /* paranoid */ verify( mock_head(this)->link.next == 0p ); 486 /* paranoid */ verify( mock_head(this)->link.ts == MAX 486 /* paranoid */ verify( mock_head(this)->link.ts == MAX ); 487 487 /* paranoid */ verify( mock_head(this) == this.prev ); 488 488 /* paranoid */ verify( __alignof__(__intrusive_lane_t) == 128 ); -
libcfa/src/concurrency/ready_subqueue.hfa
rb035046 r5024df4 32 32 /* paranoid */ verify( this.lock ); 33 33 /* paranoid */ verify( node->link.next == 0p ); 34 /* paranoid */ verify( node->link.ts== MAX );34 /* paranoid */ verify( __atomic_load_n(&node->link.ts, __ATOMIC_RELAXED) == MAX ); 35 35 /* paranoid */ verify( this.prev->link.next == 0p ); 36 /* paranoid */ verify( this.prev->link.ts== MAX );36 /* paranoid */ verify( __atomic_load_n(&this.prev->link.ts, __ATOMIC_RELAXED) == MAX ); 37 37 if( this.anchor.next == 0p ) { 38 38 /* paranoid */ verify( this.anchor.next == 0p ); 39 /* paranoid */ verify( this.anchor.ts== MAX );40 /* paranoid */ verify( this.anchor.ts!= 0 );39 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED) == MAX ); 40 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED) != 0 ); 41 41 /* paranoid */ verify( this.prev == mock_head( this ) ); 42 42 } else { 43 43 /* paranoid */ verify( this.anchor.next != 0p ); 44 /* paranoid */ verify( this.anchor.ts!= MAX );45 /* paranoid */ verify( this.anchor.ts!= 0 );44 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED) != MAX ); 45 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED) != 0 ); 46 46 /* paranoid */ verify( this.prev != mock_head( this ) ); 47 47 } … … 62 62 /* paranoid */ verify( this.lock ); 63 63 /* paranoid */ verify( this.anchor.next != 0p ); 64 /* paranoid */ verify( this.anchor.ts!= MAX );65 /* paranoid */ verify( this.anchor.ts != 0);64 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED) != MAX ); 65 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED) != 0 ); 66 66 67 67 // Get the relevant nodes locally 68 68 thread$ * node = this.anchor.next; 69 69 this.anchor.next = node->link.next; 70 this.anchor.ts = node->link.ts;70 __atomic_store_n(&this.anchor.ts, __atomic_load_n(&node->link.ts, __ATOMIC_RELAXED), __ATOMIC_RELAXED); 71 71 bool is_empty = this.anchor.next == 0p; 72 72 node->link.next = 0p; 73 node->link.ts = ULLONG_MAX;73 __atomic_store_n(&node->link.ts, ULLONG_MAX, __ATOMIC_RELAXED); 74 74 #if !defined(__CFA_NO_STATISTICS__) 75 75 this.cnt--; … … 79 79 if(is_empty) this.prev = mock_head( this ); 80 80 81 unsigned long long ats = __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED); 81 82 /* paranoid */ verify( node->link.next == 0p ); 82 /* paranoid */ verify( node->link.ts == MAX);83 /* paranoid */ verify( node->link.ts != 0);84 /* paranoid */ verify( this.anchor.ts != 0);85 /* paranoid */ verify( ( this.anchor.ts== MAX) == is_empty );86 return [node, this.anchor.ts];83 /* paranoid */ verify( __atomic_load_n(&node->link.ts , __ATOMIC_RELAXED) == MAX ); 84 /* paranoid */ verify( __atomic_load_n(&node->link.ts , __ATOMIC_RELAXED) != 0 ); 85 /* paranoid */ verify( ats != 0 ); 86 /* paranoid */ verify( (ats == MAX) == is_empty ); 87 return [node, ats]; 87 88 } 88 89 … … 96 97 // Cannot verify 'emptiness' here since it may not be locked 97 98 /* paranoid */ verify(this.anchor.ts != 0); 98 return this.anchor.ts; 99 /* paranoid */ static_assert(__atomic_always_lock_free(sizeof(this.anchor.ts), &this.anchor.ts)); 100 return __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED); 99 101 }
Note: See TracChangeset
for help on using the changeset viewer.