Changeset 07033ce for libcfa/src
- Timestamp:
- Jun 14, 2021, 4:03:50 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 1f05c83, 6f8c46d, cb5c392
- Parents:
- a8b0618
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/locks.hfa
ra8b0618 r07033ce 21 21 #include "bits/weakso_locks.hfa" 22 22 #include "containers/queueLockFree.hfa" 23 23 #include "limits.hfa" 24 24 #include "thread.hfa" 25 25 … … 85 85 bool tryP(BinaryBenaphore & this) { 86 86 ssize_t c = this.counter; 87 /* paranoid */ verify( c > MIN ); 87 88 return (c >= 1) && __atomic_compare_exchange_n(&this.counter, &c, c-1, false, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED); 88 89 } … … 92 93 ssize_t c = 0; 93 94 for () { 95 /* paranoid */ verify( this.counter < MAX ); 94 96 if (__atomic_compare_exchange_n(&this.counter, &c, c+1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) { 95 97 if (c == 0) return true;
Note: See TracChangeset
for help on using the changeset viewer.