Preserve ignored error snapshots
Some checks failed
libakerror CI Build / coverage (push) Successful in 3m39s
libakerror CI Build / cmake_build (push) Successful in 6m3s
libakerror CI Build / mutation_test (push) Has been cancelled

This commit is contained in:
2026-08-04 10:44:46 -04:00
parent 4fe7571329
commit 55090d2419
5 changed files with 51 additions and 23 deletions

View File

@@ -14,11 +14,12 @@ What that covers:
against each other and against lookups. Two threads reserving the same range
cannot both win — exactly one gets `NULL` and the other gets
`AKERR_STATUS_RANGE_OVERLAP` naming the winner.
* **Per-thread state.** `IGNORE` uses `__akerr_last_ignored` as a scratch pointer
while it logs an error, then releases the context and clears the pointer.
That scratch pointer and the last-ditch context used to report
`akerr_release_error(NULL)` are thread-local, so concurrent calls cannot
overwrite each other's state.
* **Per-thread state.** `IGNORE` copies the swallowed context into its
thread-local `__akerr_last_ignored` snapshot before releasing the pool slot.
The snapshot remains valid until that thread ignores another error, so a
later pool checkout cannot overwrite it. The snapshot and the last-ditch
context used to report `akerr_release_error(NULL)` are thread-local, so
concurrent calls cannot overwrite each other's state.
* **Handing a context from one thread to another.** A context is not thread
state — it lives in `AKERR_ARRAY_ERROR`, which is process-global — so it
outlives the thread that raised it. The reference count is the only field the