One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
#include "ledger.hpp"
|
|
|
|
namespace scoped {
|
|
bool Gate::acquire(int owner) {
|
|
if (owner < 1 || owner > owner_limit) {
|
|
++state_.denied;
|
|
return false;
|
|
}
|
|
if (state_.depth != 0 && state_.owner != owner) {
|
|
++state_.denied;
|
|
return false;
|
|
}
|
|
state_.owner = owner;
|
|
++state_.depth;
|
|
++state_.acquisitions;
|
|
if (state_.depth > state_.maximum_depth) {
|
|
state_.maximum_depth = state_.depth;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool Gate::release(int owner) {
|
|
if (owner < 1 || owner > owner_limit || state_.depth == 0 || state_.owner != owner) {
|
|
++state_.invalid_releases;
|
|
return false;
|
|
}
|
|
--state_.depth;
|
|
++state_.releases;
|
|
if (state_.depth == 0) {
|
|
state_.owner = 0;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void Gate::reset() {
|
|
state_ = GateView{};
|
|
}
|
|
|
|
GateView Gate::view() const {
|
|
return state_;
|
|
}
|
|
|
|
Scope::Scope(Gate& gate, int owner)
|
|
: gate_(gate), owner_(owner), acquired_(gate.acquire(owner)) {
|
|
}
|
|
|
|
Scope::~Scope() {
|
|
if (acquired_) {
|
|
gate_.release(owner_);
|
|
}
|
|
}
|
|
|
|
bool Scope::acquired() const {
|
|
return acquired_;
|
|
}
|
|
}
|