Compare arrivals at a barrier against the expected parties and turn the pending count into a release, wait, or escalate remediation action.

Countdown Barrier Remediation Report

countdown_barrier_remediation_report.cpp
#include <iostream>
#include <string>

int main() {
    int arrivals = ;
    const int parties = 3;
    int done = arrivals;
    if (done > parties) {
        done = parties;
    }
    int pending = parties - done;

    std::string action;
    if (pending == 0) {
        action = "release";
    } else if (pending <= 1) {
        action = "wait";
    } else {
        action = "escalate";
    }

    std::cout << "parties=" << parties
              << " done=" << done
              << " pending=" << pending
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int arrivals = ;
    const int parties = 3;
    int done = arrivals;
    if (done > parties) {
        done = parties;
    }
    int pending = parties - done;

    std::string action;
    if (pending == 0) {
        action = "release";
    } else if (pending <= 1) {
        action = "wait";
    } else {
        action = "escalate";
    }

    std::cout << "parties=" << parties
              << " done=" << done
              << " pending=" << pending
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int arrivals = ;
    const int parties = 3;
    int done = arrivals;
    if (done > parties) {
        done = parties;
    }
    int pending = parties - done;

    std::string action;
    if (pending == 0) {
        action = "release";
    } else if (pending <= 1) {
        action = "wait";
    } else {
        action = "escalate";
    }

    std::cout << "parties=" << parties
              << " done=" << done
              << " pending=" << pending
              << " " << action << std::endl;
    return 0;
}
barrier pending The expected parties and arrivals are scalars, so the pending work that drives the remediation action stays deterministic without waiting on a live barrier.