If a test fails in a timeout or a test failure, longjmp() is used to restore
the thread context and handle test failure. However, there might be unreleased
resources, namely locks, which prevent the library to clean up properly after
finishing the test.
By using thread cleanup handlers, we can release any test subject internal or
test specific external resources on test failure. We do so by calling all
registered cleanup handlers.
tfun->cb(i);
return TRUE;
}
+ thread_cleanup_popall();
return FALSE;
}
}
else
{
+ thread_cleanup_popall();
failure = TRUE;
break;
}
}
else
{
+ thread_cleanup_popall();
library_deinit();
return FALSE;
}