- File:
-
- 1 edited
-
libcfa/src/concurrency/ready_subqueue.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_subqueue.hfa
r5024df4 r8a5e357 32 32 /* paranoid */ verify( this.lock ); 33 33 /* paranoid */ verify( node->link.next == 0p ); 34 /* paranoid */ verify( __atomic_load_n(&node->link.ts, __ATOMIC_RELAXED)== MAX );34 /* paranoid */ verify( node->link.ts == MAX ); 35 35 /* paranoid */ verify( this.prev->link.next == 0p ); 36 /* paranoid */ verify( __atomic_load_n(&this.prev->link.ts, __ATOMIC_RELAXED)== MAX );36 /* paranoid */ verify( this.prev->link.ts == MAX ); 37 37 if( this.anchor.next == 0p ) { 38 38 /* paranoid */ verify( this.anchor.next == 0p ); 39 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED)== MAX );40 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED)!= 0 );39 /* paranoid */ verify( this.anchor.ts == MAX ); 40 /* paranoid */ verify( this.anchor.ts != 0 ); 41 41 /* paranoid */ verify( this.prev == mock_head( this ) ); 42 42 } else { 43 43 /* paranoid */ verify( this.anchor.next != 0p ); 44 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED)!= MAX );45 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED)!= 0 );44 /* paranoid */ verify( this.anchor.ts != MAX ); 45 /* paranoid */ verify( this.anchor.ts != 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( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED)!= MAX );65 /* paranoid */ verify( __atomic_load_n(&this.anchor.ts, __ATOMIC_RELAXED) != 0);64 /* paranoid */ verify( this.anchor.ts != MAX ); 65 /* paranoid */ verify( this.anchor.ts != 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 __atomic_store_n(&this.anchor.ts, __atomic_load_n(&node->link.ts, __ATOMIC_RELAXED), __ATOMIC_RELAXED);70 this.anchor.ts = node->link.ts; 71 71 bool is_empty = this.anchor.next == 0p; 72 72 node->link.next = 0p; 73 __atomic_store_n(&node->link.ts, ULLONG_MAX, __ATOMIC_RELAXED);73 node->link.ts = MAX; 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);82 81 /* paranoid */ verify( node->link.next == 0p ); 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];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]; 88 87 } 89 88 … … 97 96 // Cannot verify 'emptiness' here since it may not be locked 98 97 /* paranoid */ verify(this.anchor.ts != 0); 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); 98 return this.anchor.ts; 101 99 }
Note:
See TracChangeset
for help on using the changeset viewer.