Release ignored error contexts #21
Reference in New Issue
Block a user
Delete Branch "14"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #14.
Summary
Tests
eec5726d91to4fe7571329@@ -105,2 +100,3 @@/* IGNORE's scratch pointer is thread-local while logging and cleared after* release. Concurrent ignored errors must all return their pool slots. */IGNORE(ignorable(arg));AKERR_TCHECK(arg, __akerr_last_ignored != NULL);IGNORE() retained a reference to the last ignored error on purpose, so that subsequent errors that may be related could reference it. Instead of completely abandoning it (and the pattern that allows it), why not turn __akerr_last_ignored into a static variable, IGNORE() does a
memcpy()into it from the exception being ignored, then releases the exception? That seems like it would give us the best of both worlds.@logikoma ^ implement this
Implemented the requested review change. IGNORE() now copies the error into a per-thread static snapshot with a repaired stack-trace cursor, logs that snapshot, and releases the original pool context. Tests verify the snapshot survives slot reuse in both single-threaded and threaded runs. Full CTest, ThreadSanitizer, and no-thread CTest pass.
@@ -441,0 +438,4 @@do { \akerr_ErrorContext *__akerr_ignored = __stmt; \if ( __akerr_ignored != NULL ) { \memcpy(&__akerr_last_ignored, __akerr_ignored, \@logikoma the
__akerr_last_ignoredvariable is only really useful to users of the public facing API, so I'm not sure it makes sense to prefix it with__as part of the private API. Let's remove the__prefix on this variable and make it public.Implemented in
5a269ea. IGNORE() now copies the ignored context into the per-thread static snapshot, repairs the copied stack-trace cursor, logs it, and releases the pool context. The public snapshot is now named akerr_last_ignored. Normal tests pass 36/36; AKERR_THREADS=none passes 32/32.