From f2a15528228f9e67ed3bc8121ac888bf2b962823 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 1 Mar 2021 08:24:59 -0600 Subject: H5TS_win32_thread_exit (#396) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int --- .github/CODEOWNERS | 8 ++-- src/H5TS.c | 81 +++++++++++++++++++++++++++------------ tools/src/h5ls/h5ls.c | 5 +-- tools/test/h5dump/h5dumpgentest.c | 2 +- 4 files changed, 62 insertions(+), 34 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 97b7428..c807e75 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,7 +13,7 @@ CMakeTests.* @byrnHDF @derobins /bin/ @lrknox @derobins @qkoziol -/c++/ @bmribler @byrnHDF +/c++/ @bmribler @byrnHDF @derobins /config/ @lrknox @derobins @qkoziol @byrnHDF @@ -23,7 +23,7 @@ CMakeTests.* @byrnHDF @derobins /fortran/ @brtnfld @epourmal -/hl/ @bmribler @byrnHDF +/hl/ @bmribler @byrnHDF @derobins /java/ @jhendersonHDF @byrnHDF @@ -37,6 +37,6 @@ CMakeTests.* @byrnHDF @derobins /testpar/ @jhendersonHDF @rawarren @jrmainzer @qkoziol -/tools/ @byrnHDF @bmribler +/tools/ @byrnHDF @bmribler @derobins -/utils/ @lrknox @byrnHDF +/utils/ @lrknox @byrnHDF @derobins diff --git a/src/H5TS.c b/src/H5TS.c index 90b1244..258c9df 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -12,13 +12,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: This file contains the framework for ensuring that the global - * library lock is held when an API routine is called. This + * Purpose: This file contains the framework for ensuring that the global + * library lock is held when an API routine is called. This * framework works in concert with the FUNC_ENTER_API / FUNC_LEAVE_API - * macros defined in H5private.h. + * macros defined in H5private.h. * - * Note: Because this threadsafety framework operates outside the library, - * it does not use the error stack and only uses the "namecheck only" + * Note: Because this threadsafety framework operates outside the library, + * it does not use the error stack and only uses the "namecheck only" * FUNC_ENTER_* / FUNC_LEAVE_* macros. */ @@ -70,23 +70,45 @@ static herr_t H5TS__mutex_unlock(H5TS_mutex_t *mutex, unsigned int *lock_count); /* Global variable definitions */ #ifdef H5_HAVE_WIN_THREADS H5TS_once_t H5TS_first_init_g; -#else /* H5_HAVE_WIN_THREADS */ -H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT; -#endif /* H5_HAVE_WIN_THREADS */ +#else +H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT; +#endif /* Thread-local keys, used by other interfaces */ -H5TS_key_t H5TS_errstk_key_g; /* Error stack */ +/* Error stack */ +#ifdef H5_HAVE_WIN_THREADS +H5TS_key_t H5TS_errstk_key_g = TLS_OUT_OF_INDEXES; +#else +H5TS_key_t H5TS_errstk_key_g; +#endif + #ifdef H5_HAVE_CODESTACK -H5TS_key_t H5TS_funcstk_key_g; /* Function stack */ -#endif /* H5_HAVE_CODESTACK */ -H5TS_key_t H5TS_apictx_key_g; /* API context */ +/* Function stack */ +#ifdef H5_HAVE_WIN_THREADS +H5TS_key_t H5TS_funcstk_key_g = TLS_OUT_OF_INDEXES; +#else +H5TS_key_t H5TS_funcstk_key_g; +#endif +#endif /* H5_HAVE_CODESTACK */ + +/* API context */ +#ifdef H5_HAVE_WIN_THREADS +H5TS_key_t H5TS_apictx_key_g = TLS_OUT_OF_INDEXES; +#else +H5TS_key_t H5TS_apictx_key_g; +#endif /*******************/ /* Local Variables */ /*******************/ /* Thread-local keys, used in this module */ -static H5TS_key_t H5TS_cancel_key_s; /* Thread cancellation state */ +/* Thread cancellation state */ +#ifdef H5_HAVE_WIN_THREADS +static H5TS_key_t H5TS_cancel_key_s = TLS_OUT_OF_INDEXES; +#else +static H5TS_key_t H5TS_cancel_key_s; +#endif #ifndef H5_HAVE_WIN_THREADS @@ -871,11 +893,14 @@ H5TS_win32_process_exit(void) DeleteCriticalSection(&H5_g.init_lock.CriticalSection); /* Clean up per-process thread local storage */ - TlsFree(H5TS_errstk_key_g); + if (H5TS_errstk_key_g != TLS_OUT_OF_INDEXES) + TlsFree(H5TS_errstk_key_g); #ifdef H5_HAVE_CODESTACK - TlsFree(H5TS_funcstk_key_g); + if (H5TS_funcstk_key_g != TLS_OUT_OF_INDEXES) + TlsFree(H5TS_funcstk_key_g); #endif /* H5_HAVE_CODESTACK */ - TlsFree(H5TS_apictx_key_g); + if (H5TS_apictx_key_g != TLS_OUT_OF_INDEXES) + TlsFree(H5TS_apictx_key_g); FUNC_LEAVE_NOAPI_VOID_NAMECHECK_ONLY } /* H5TS_win32_process_exit() */ @@ -909,19 +934,25 @@ H5TS_win32_thread_exit(void) */ /* Clean up per-thread thread local storage */ - lpvData = TlsGetValue(H5TS_errstk_key_g); - if (lpvData) - LocalFree((HLOCAL)lpvData); + if (H5TS_errstk_key_g != TLS_OUT_OF_INDEXES) { + lpvData = TlsGetValue(H5TS_errstk_key_g); + if (lpvData) + LocalFree((HLOCAL)lpvData); + } #ifdef H5_HAVE_CODESTACK - lpvData = TlsGetValue(H5TS_funcstk_key_g); - if (lpvData) - LocalFree((HLOCAL)lpvData); + if (H5TS_funcstk_key_g != TLS_OUT_OF_INDEXES) { + lpvData = TlsGetValue(H5TS_funcstk_key_g); + if (lpvData) + LocalFree((HLOCAL)lpvData); + } #endif /* H5_HAVE_CODESTACK */ - lpvData = TlsGetValue(H5TS_apictx_key_g); - if (lpvData) - LocalFree((HLOCAL)lpvData); + if (H5TS_apictx_key_g != TLS_OUT_OF_INDEXES) { + lpvData = TlsGetValue(H5TS_apictx_key_g); + if (lpvData) + LocalFree((HLOCAL)lpvData); + } FUNC_LEAVE_NOAPI_NAMECHECK_ONLY(ret_value) } /* H5TS_win32_thread_exit() */ diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 64003e7..09bc323 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -530,10 +530,7 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) h5tools_str_append(buffer, "native hbool_t"); } else { - if (H5T_FLOAT == H5Tget_class(type)) - return print_float_type(buffer, type, ind); - else - return print_int_type(buffer, type, ind); + return print_int_type(buffer, type, ind); } } else { diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 15d3eef..5507ede 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -6356,7 +6356,7 @@ gent_ldouble_scalar(void) if ((sid = H5Screate(H5S_SCALAR)) < 0) goto error; - if ((tid = H5Tarray_create(H5T_NATIVE_LDOUBLE, 1, dims)) < 0) + if ((tid = H5Tarray_create2(H5T_NATIVE_LDOUBLE, 1, dims)) < 0) goto error; if (H5Tget_size(tid) == 0) -- cgit v0.12