Archived
util: a log_once for the warnings that speak once per process
Three sites -- the kvstream clamp (L-02), the batch overlap guard and the bidi-plane belt -- each open-coded the same four lines: a function- local static atomic<bool>, a bool expected, and a compare_exchange to decide which of the many steps gets to print. The pattern is the point, not the flag name (said, said2), so it moved to rad_internal.h as log_once(flag): true on the first call, false after. No behaviour change -- same first-of-many warnings, same compare-exchange thread-safety, exactly one winner per flag -- only the idiom is now named instead of re-typed where a fourth once-warning is ever needed.
This commit is contained in:
1 parent
b9ecbde0d6
commit
c3a4775f54
3 files changed
+12
-6
No files matched your search
@@ -223,8 +223,7 @@ bool stage_src(Ctx* ctx, int group, const RadKVGroupBatch* kvb, int layer, Stage
|
||||
* attention then reads a row that is part copy and part stale. The clamp is the
|
||||
* memory-safe answer; this is the promise that it is never a silent one. */
|
||||
static std::atomic<bool> said{false};
|
||||
bool expected = false;
|
||||
if (said.compare_exchange_strong(expected, true))
|
||||
if (log_once(said))
|
||||
RAD_WARN("kvstream: group %d stage runs reach past the host layer's end (%lld of "
|
||||
"%lld bytes): the stage drops what lies past it, and staged attention "
|
||||
"reads stale bytes there (first of possibly many)",
|
||||
|
||||
Reference in new issue
Block a user