[libc-commits] [libc] [libc] Reset thread-specific key value before invoking destructor (PR #226134)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Tue Sep 29 04:06:15 PDT 2026
================
@@ -161,11 +162,20 @@ void call_atexit_callbacks() {
atexit_callback_mgr.call();
// Thread-specific keys (pthread_key_create).
- for (size_t i = 0; i < TSS_KEY_COUNT; ++i) {
- TSSValueUnit &unit = tss_values[i];
- // Both dtor and value need to nonnull to call dtor
- if (unit.dtor != nullptr && unit.payload != nullptr)
- unit.dtor(unit.payload);
+ for (size_t iter = 0; iter < PTHREAD_DESTRUCTOR_ITERATIONS; ++iter) {
+ bool called_dtor = false;
+ for (size_t i = 0; i < TSS_KEY_COUNT; ++i) {
----------------
labath wrote:
Indeed. Done.
https://github.com/llvm/llvm-project/pull/226134
More information about the libc-commits
mailing list