Turn the number of waiters behind a held guard into an enter, backoff, or page remediation action.

Atomic Guard Remediation Report

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

int main() {
    int waiters = ;
    const int guardLimit = 2;
    int acquired = 1;

    std::string action;
    if (waiters == 0) {
        action = "enter";
    } else if (waiters <= guardLimit) {
        action = "backoff";
    } else {
        action = "page";
    }

    std::cout << "waiters=" << waiters
              << " acquired=" << acquired
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int waiters = ;
    const int guardLimit = 2;
    int acquired = 1;

    std::string action;
    if (waiters == 0) {
        action = "enter";
    } else if (waiters <= guardLimit) {
        action = "backoff";
    } else {
        action = "page";
    }

    std::cout << "waiters=" << waiters
              << " acquired=" << acquired
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int waiters = ;
    const int guardLimit = 2;
    int acquired = 1;

    std::string action;
    if (waiters == 0) {
        action = "enter";
    } else if (waiters <= guardLimit) {
        action = "backoff";
    } else {
        action = "page";
    }

    std::cout << "waiters=" << waiters
              << " acquired=" << acquired
              << " " << action << std::endl;
    return 0;
}
guard contention The waiter count behind a held guard is kept as a scalar, so the remediation action stays deterministic and never depends on atomic identity or scheduler timing.