From 277f42b49219d85dd263c78cc78382d787dd99af Mon Sep 17 00:00:00 2001 From: Matthew Larson Date: Thu, 19 Sep 2024 09:30:30 -0500 Subject: [PATCH] Move mutex/key release back into tinfo_term --- src/H5TSint.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/H5TSint.c b/src/H5TSint.c index 8a658852e31..c417020a574 100644 --- a/src/H5TSint.c +++ b/src/H5TSint.c @@ -150,12 +150,6 @@ H5TS_term_package(void) /* Tell subsequent library opens that thread information is not initialized */ H5TS_first_init_s = H5TS_ONCE_INITIALIZER; - /* Release critical section / mutex for modifying the thread info globals */ - H5_UNLIKELY(H5TS_mutex_destroy(&H5TS_tinfo_mtx_s)); - - /* Release key for thread-specific API contexts */ - H5_UNLIKELY(H5TS_key_delete(H5TS_thrd_info_key_g)); - /* Reset global API lock info */ H5TS_mutex_destroy(&H5TS_api_info_p.api_mutex); H5TS_atomic_destroy_uint(&H5TS_api_info_p.attempt_lock_count); @@ -586,12 +580,12 @@ H5TS__tinfo_term(void) H5MM_free(tinfo_node); } - /* Clear the thread info key to prevent bad reuse if the library is re-opened later in this process */ - if (H5_UNLIKELY(H5TS_key_set_value(H5TS_thrd_info_key_g, NULL) < 0)) + /* Release key for thread-specific API contexts */ + if (H5_UNLIKELY(H5TS_key_delete(H5TS_thrd_info_key_g)) < 0) HGOTO_DONE(FAIL); - /* End the critical section for modifying the thread info globals */ - if (H5_UNLIKELY(H5TS_mutex_unlock(&H5TS_tinfo_mtx_s) < 0)) + /* Release critical section / mutex for modifying the thread info globals */ + if (H5_UNLIKELY(H5TS_mutex_destroy(&H5TS_tinfo_mtx_s)) < 0) HGOTO_DONE(FAIL); done: