Changeset a18373a for libcfa/src/concurrency/barrier.hfa
- Timestamp:
- Apr 1, 2022, 2:46:28 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 12048a1, 63db8fd7
- Parents:
- 5b7fea7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/barrier.hfa
r5b7fea7 ra18373a 42 42 // second last thread returns 1 43 43 // etc. 44 static inline unsigned block(barrier & mutex this ) { 44 // last is an optional hook that will be called by the last thread 45 // before unblocking the others 46 static inline unsigned block(barrier & mutex this, fptr_t last = (fptr_t)0 ) { 45 47 this.count -= 1; // prefix decrement so we the last is 0 and not 1 46 48 unsigned arrival = this.count; // Note arrival order 47 49 if(arrival == 0) { 50 if(last) last(); 48 51 // If arrived last unblock everyone and reset 49 52 signal_all(this.c);
Note: See TracChangeset
for help on using the changeset viewer.