Skip to content

Commit

Permalink
Move mutex/key release back into tinfo_term
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Sep 19, 2024
1 parent fcc5446 commit 277f42b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/H5TSint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 277f42b

Please sign in to comment.