Changeset e20eaf4
- Timestamp:
- Mar 29, 2021, 2:15:59 PM (2 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 976bc68
- Parents:
- 31fc80f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/locks.hfa
r31fc80f re20eaf4 82 82 83 83 // returns true if no blocking needed 84 bool P(BinaryBenaphore & this) { return __atomic_fetch_sub(&this.counter, 1, __ATOMIC_SEQ_CST) > 0; } 84 bool P(BinaryBenaphore & this) { 85 return __atomic_fetch_sub(&this.counter, 1, __ATOMIC_SEQ_CST) > 0; 86 } 87 85 88 bool tryP(BinaryBenaphore & this) { 86 89 ssize_t c = this.counter; … … 115 118 static inline void ?{}(ThreadBenaphore & this, one_t ) { (this.ben){ 1 }; } 116 119 117 static inline bool P(ThreadBenaphore & this) { return /* P(this.ben) ? false : */P(this.sem); }118 static inline bool P(ThreadBenaphore & this, $thread * t) { return /* P(this.ben) ? false : */P(this.sem, t ); }120 static inline bool P(ThreadBenaphore & this) { return P(this.ben) ? false : P(this.sem); } 121 static inline bool P(ThreadBenaphore & this, $thread * t) { return P(this.ben) ? false : P(this.sem, t ); } 119 122 static inline bool tryP(ThreadBenaphore & this) { return tryP(this.ben); } 120 123 static inline bool P(ThreadBenaphore & this, bool wait) { return wait ? P(this) : tryP(this); } 121 124 122 125 static inline $thread * V(ThreadBenaphore & this, const bool doUnpark = true) { 123 //if (V(this.ben)) return 0p;126 if (V(this.ben)) return 0p; 124 127 return V(this.sem, doUnpark); 125 128 }
Note: See TracChangeset
for help on using the changeset viewer.