bool CancellationChecker::shouldStopExecutionSyscallSafe()

in src/cancellation_checker.cpp [13:29]


bool CancellationChecker::shouldStopExecutionSyscallSafe() const {
    if (performedChecks == checksToPerform) {
        std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
        if (now - lastSuccessfulCheck < std::chrono::seconds(1) &&
            checksToPerform < std::numeric_limits<unsigned int>::max() / 10) {
            checksToPerform *= 10;
        } else {
            checksToPerform = defaultChecksToPerformValue;
        }
        lastSuccessfulCheck = now;
        performedChecks = 0;
        return fileExists(cancellationFileName) || finishTime < now;
    }

    performedChecks++;
    return false;
}