Changes in / [f621e43f:a41e87b]
- Files:
-
- 4 deleted
- 2 edited
-
libcfa/src/concurrency/locks.hfa (modified) (2 diffs)
-
tests/concurrent/.expect/semaphore.txt (deleted)
-
tests/concurrent/semaphore.cfa (deleted)
-
tests/concurrent/spinaphore.cfa (modified) (2 diffs)
-
tests/unified_locking/.expect/fast.txt (deleted)
-
tests/unified_locking/fast.cfa (deleted)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/locks.hfa
rf621e43f ra41e87b 82 82 83 83 // returns true if no blocking needed 84 bool P(BinaryBenaphore & this) { 85 return __atomic_fetch_sub(&this.counter, 1, __ATOMIC_SEQ_CST) > 0; 86 } 87 84 bool P(BinaryBenaphore & this) { return __atomic_fetch_sub(&this.counter, 1, __ATOMIC_SEQ_CST) > 0; } 88 85 bool tryP(BinaryBenaphore & this) { 89 86 ssize_t c = this.counter; … … 118 115 static inline void ?{}(ThreadBenaphore & this, one_t ) { (this.ben){ 1 }; } 119 116 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 ); }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 ); } 122 119 static inline bool tryP(ThreadBenaphore & this) { return tryP(this.ben); } 123 120 static inline bool P(ThreadBenaphore & this, bool wait) { return wait ? P(this) : tryP(this); } 124 121 125 122 static inline $thread * V(ThreadBenaphore & this, const bool doUnpark = true) { 126 if (V(this.ben)) return 0p;123 // if (V(this.ben)) return 0p; 127 124 return V(this.sem, doUnpark); 128 125 } -
tests/concurrent/spinaphore.cfa
rf621e43f ra41e87b 36 36 this.sum = 0; 37 37 for(num_blocks) { 38 // sout | "b P" | me; 38 39 P(sem); 39 40 if(((thread&)this).seqable.next != 0p) sout | "Link not invalidated"; 41 // sout | "a P" | me; 40 42 } 41 43 } … … 56 58 this.sum += (unsigned)b; 57 59 unpark(t); 60 // sout | "a V" | t; 58 61 yield(random(10)); 59 62 }
Note:
See TracChangeset
for help on using the changeset viewer.