Preserve ignored error snapshots
This commit is contained in:
@@ -90,6 +90,9 @@ static void one_checkout(akerr_ThreadArg *arg)
|
||||
static void *pool_body(void *raw)
|
||||
{
|
||||
akerr_ThreadArg *arg = raw;
|
||||
char expected[64];
|
||||
|
||||
snprintf(expected, sizeof(expected), "ignored by thread %d", arg->id);
|
||||
pthread_barrier_wait(arg->barrier);
|
||||
|
||||
for ( int i = 0; i < ITERATIONS; i++ ) {
|
||||
@@ -97,10 +100,21 @@ static void *pool_body(void *raw)
|
||||
one_checkout(arg);
|
||||
}
|
||||
|
||||
/* IGNORE's scratch pointer is thread-local while logging and cleared after
|
||||
/* IGNORE's snapshot is thread-local while logging and remains valid after
|
||||
* release. Concurrent ignored errors must all return their pool slots. */
|
||||
IGNORE(ignorable(arg));
|
||||
AKERR_TCHECK(arg, __akerr_last_ignored == NULL);
|
||||
AKERR_TCHECK(arg, __akerr_last_ignored.status == AKERR_IO);
|
||||
AKERR_TCHECK(arg, strcmp(__akerr_last_ignored.message, expected) == 0);
|
||||
|
||||
/* Reuse a slot after IGNORE and prove that the copied snapshot did not
|
||||
* become an alias for the newly acquired context. */
|
||||
akerr_ErrorContext *reused = akerr_next_error();
|
||||
AKERR_TCHECK(arg, reused != NULL);
|
||||
if ( reused != NULL ) {
|
||||
RELEASE_ERROR(reused);
|
||||
}
|
||||
AKERR_TCHECK(arg, __akerr_last_ignored.status == AKERR_IO);
|
||||
AKERR_TCHECK(arg, strcmp(__akerr_last_ignored.message, expected) == 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user