Changeset a18373a


Ignore:
Timestamp:
Apr 1, 2022, 2:46:28 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
12048a1, 63db8fd7
Parents:
5b7fea7
Message:

Added a hook for the barrier's last block.
Added testing to go with it.

Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/barrier.hfa

    r5b7fea7 ra18373a  
    4242//      second last thread returns 1
    4343//      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
     46static inline unsigned block(barrier & mutex this, fptr_t last = (fptr_t)0 ) {
    4547        this.count -= 1; // prefix decrement so we the last is 0 and not 1
    4648        unsigned arrival = this.count; // Note arrival order
    4749        if(arrival == 0) {
     50                if(last) last();
    4851                // If arrived last unblock everyone and reset
    4952                signal_all(this.c);
Note: See TracChangeset for help on using the changeset viewer.