Changeset 660665f for libcfa/src/concurrency/locks.hfa
- Timestamp:
- Jun 29, 2021, 5:35:19 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- dcad80a
- Parents:
- 5a46e09 (diff), d02e547 (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/locks.hfa
r5a46e09 r660665f 24 24 #include "containers/list.hfa" 25 25 26 #include "limits.hfa" 26 27 #include "thread.hfa" 27 28 … … 87 88 bool tryP(BinaryBenaphore & this) { 88 89 ssize_t c = this.counter; 90 /* paranoid */ verify( c > MIN ); 89 91 return (c >= 1) && __atomic_compare_exchange_n(&this.counter, &c, c-1, false, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED); 90 92 } … … 94 96 ssize_t c = 0; 95 97 for () { 98 /* paranoid */ verify( this.counter < MAX ); 96 99 if (__atomic_compare_exchange_n(&this.counter, &c, c+1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) { 97 100 if (c == 0) return true; … … 173 176 ThreadBenaphore sem; 174 177 }; 178 179 static inline void ?{}(fast_lock & this) { this.owner = 0p; } 175 180 176 181 static inline bool $try_lock(fast_lock & this, $thread * thrd) {
Note: See TracChangeset
for help on using the changeset viewer.