Admit readers against a fixed pool capacity and turn the remaining slots into an admit, hold, or shed remediation action.

Reader Pool Remediation Report

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

int main() {
    int readers = ;
    const int capacity = 3;
    int admitted = readers;
    if (admitted > capacity) {
        admitted = capacity;
    }
    int remaining = capacity - admitted;

    std::string action;
    if (remaining >= 2) {
        action = "admit";
    } else if (remaining == 1) {
        action = "hold";
    } else {
        action = "shed";
    }

    std::cout << "readers=" << readers
              << " admitted=" << admitted
              << " remaining=" << remaining
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int readers = ;
    const int capacity = 3;
    int admitted = readers;
    if (admitted > capacity) {
        admitted = capacity;
    }
    int remaining = capacity - admitted;

    std::string action;
    if (remaining >= 2) {
        action = "admit";
    } else if (remaining == 1) {
        action = "hold";
    } else {
        action = "shed";
    }

    std::cout << "readers=" << readers
              << " admitted=" << admitted
              << " remaining=" << remaining
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int readers = ;
    const int capacity = 3;
    int admitted = readers;
    if (admitted > capacity) {
        admitted = capacity;
    }
    int remaining = capacity - admitted;

    std::string action;
    if (remaining >= 2) {
        action = "admit";
    } else if (remaining == 1) {
        action = "hold";
    } else {
        action = "shed";
    }

    std::cout << "readers=" << readers
              << " admitted=" << admitted
              << " remaining=" << remaining
              << " " << action << std::endl;
    return 0;
}
remaining capacity The reader pool capacity is modeled with a scalar counter, so the remaining slots stay deterministic and free of atomic identity while driving the remediation action.