Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H5TS_win32_thread_exit #396

Merged
merged 97 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
23e0df3
OESS-98 convert plugin option to FetchContent, add tests
byrnHDF Dec 10, 2020
84293f5
Fixes for pkcfg files because of plugin option
byrnHDF Dec 11, 2020
544bd61
OESS-98 fix tools test for plugins
byrnHDF Dec 15, 2020
ffb182f
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 8, 2021
2561b6b
Keep doxygen comments under 100 chars long - format hint
byrnHDF Jan 8, 2021
1c73615
Whitespace
byrnHDF Jan 8, 2021
b71a853
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 11, 2021
b68973c
HDFFV-11144 - Reclassify CMake messages
byrnHDF Jan 11, 2021
f64497d
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 13, 2021
c854ffe
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 14, 2021
0f90d26
HDFFV-11099/11100 added help text
byrnHDF Jan 14, 2021
20757d6
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 15, 2021
d161733
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 20, 2021
f03b095
Reworked switch statement to compare string instead
byrnHDF Jan 22, 2021
bd52065
Fix typo
byrnHDF Jan 22, 2021
238c060
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 25, 2021
f12b2ae
Update CDash mode
byrnHDF Jan 26, 2021
673aac8
Correct name of threadsafe
byrnHDF Jan 26, 2021
97df6db
Correct option name
byrnHDF Jan 26, 2021
e48f758
Undo accidental commit
byrnHDF Jan 26, 2021
2f364d8
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 27, 2021
f42f02b
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 27, 2021
5b48b33
Note LLVM 10 to 11 format default changes
byrnHDF Jan 27, 2021
9927372
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 28, 2021
ad61d57
Update format plugin
byrnHDF Jan 28, 2021
613bc7a
Undo clang-format version 11 changes
byrnHDF Jan 28, 2021
0114098
One more correction
byrnHDF Jan 28, 2021
a685efa
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Jan 29, 2021
78f25ac
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 1, 2021
1899ba6
Update supported platforms
byrnHDF Feb 2, 2021
28d6d63
Revert whitespace changes
byrnHDF Feb 2, 2021
f1a0239
Correct whitespace
byrnHDF Feb 2, 2021
b656722
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 3, 2021
1c9eaf4
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 4, 2021
f85f7da
Changes from PR#3
byrnHDF Feb 4, 2021
464d08e
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 5, 2021
34ad32c
HDFFV-11213 added option to control gcc10 warnings diagnostics
byrnHDF Feb 5, 2021
d6db05b
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into
byrnHDF Feb 8, 2021
264caff
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 9, 2021
9b42150
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 10, 2021
4569d39
HDFFV-11212 Use the new references correctly in JNI utility and tests
byrnHDF Feb 11, 2021
4a2865c
format source
byrnHDF Feb 11, 2021
1a2dc75
Fix typo
byrnHDF Feb 11, 2021
23679fa
Add new test file
byrnHDF Feb 11, 2021
232426b
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 16, 2021
020a40c
HDFFV-11212 - update test and remove unused arg
byrnHDF Feb 16, 2021
2352972
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 17, 2021
5806658
Minor non-space formatting changes
byrnHDF Feb 18, 2021
83b619f
Use H5I_INVALID_ID instead of "-1"
byrnHDF Feb 19, 2021
fbf97be
source formatting
byrnHDF Feb 19, 2021
ea94075
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 19, 2021
797a6c2
add missing testfile, update jni function
byrnHDF Feb 19, 2021
32d6ee9
Undo commit of debug code
byrnHDF Feb 19, 2021
71c4557
remove mislocated file
byrnHDF Feb 19, 2021
2c6df43
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 19, 2021
66d54a9
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 19, 2021
08c7738
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 19, 2021
46c620f
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 22, 2021
a4132c8
Fix h5repack test for handling of fapls and id close
byrnHDF Feb 22, 2021
498d7ec
Update h5diff test files usage text
byrnHDF Feb 22, 2021
82ff537
HDFFV-11212 add new ref tests for JNI export dataset
byrnHDF Feb 22, 2021
7e81307
src format update
byrnHDF Feb 22, 2021
4bda56f
Remove blank line typo
byrnHDF Feb 22, 2021
25884a6
src format typo
byrnHDF Feb 22, 2021
07d8cf2
long double requires %Lg
byrnHDF Feb 22, 2021
8735c2a
Another long double foramt specifer S.B. %Lg
byrnHDF Feb 22, 2021
140aca0
issue with t128bit test
byrnHDF Feb 22, 2021
c790f17
Windows issue with h5dump and type.
byrnHDF Feb 22, 2021
eb3f7cc
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 23, 2021
76d4fba
Fix review issues
byrnHDF Feb 23, 2021
7b96c23
refactor function nesting and fix error checks
byrnHDF Feb 23, 2021
90bb747
format fixes
byrnHDF Feb 23, 2021
321b926
Remove untested functions and javadoc quiet comments
byrnHDF Feb 23, 2021
2d40134
Restore TRY block.
byrnHDF Feb 24, 2021
b8cda57
Change string append errors to memory exception
byrnHDF Feb 24, 2021
ec3c879
revert to H5_JNI_FATAL_ERROR - support functions need work
byrnHDF Feb 24, 2021
0a56190
Add assertion error for h5util functions
byrnHDF Feb 24, 2021
282ac70
remove duplicate function
byrnHDF Feb 24, 2021
9eae4f5
format fix
byrnHDF Feb 24, 2021
a3d7f13
Revert HD function error handling
byrnHDF Feb 24, 2021
3ea3719
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 25, 2021
2a71393
Update copyright comments
byrnHDF Feb 25, 2021
68d7443
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 25, 2021
dab6971
GH #386 java folder copyright corrections
byrnHDF Feb 26, 2021
bfa3508
Whitespace
byrnHDF Feb 26, 2021
b42646f
GH #359 implement and fix tools 1.6 API usage
byrnHDF Feb 26, 2021
f10a3a1
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Feb 26, 2021
6d17d6f
remove excessive comments
byrnHDF Feb 26, 2021
a9bd5ba
Flip inits to correct ifdef section
byrnHDF Feb 26, 2021
7037609
rework ifdef to be simpler
byrnHDF Feb 26, 2021
9e7b3d7
format issue
byrnHDF Feb 26, 2021
d76e848
Reformat ifdef inits
byrnHDF Feb 26, 2021
49e5203
remove static attribute
byrnHDF Feb 26, 2021
53a1528
format compliance
byrnHDF Feb 26, 2021
bb01c7b
Update names
byrnHDF Feb 28, 2021
70a7b81
Merge branch 'develop' of https://github.com/HDFGroup/hdf5.git into d…
byrnHDF Mar 1, 2021
97ed2a4
Revert because logic relies on float not being int
byrnHDF Mar 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 58 additions & 27 deletions src/H5TS.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/

Expand Down Expand Up @@ -68,25 +68,47 @@ 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 */
H5TS_once_t H5TS_first_init_g
#ifndef H5_HAVE_WIN_THREADS
= PTHREAD_ONCE_INIT
#endif
;

/* Thread-local keys, used by other interfaces */
H5TS_key_t H5TS_errstk_key_g; /* Error stack */
/* Error stack */
H5TS_key_t H5TS_errstk_key_g
#ifdef H5_HAVE_WIN_THREADS
= TLS_OUT_OF_INDEXES
#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 */
H5TS_key_t H5TS_funcstk_key_g
#ifdef H5_HAVE_WIN_THREADS
= TLS_OUT_OF_INDEXES
#endif
;
#endif /* H5_HAVE_CODESTACK */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not a fan of this format. I'd just duplicate the variable declaration, as is done below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that one - but with 4 instances it was way too busy and the formatter insisted on tabs making it look wierder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem I had was the original had some comments that just made it looked messy!
Updated with better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the static attribute okay? I think I accidentally used the H5TS_key_t H5TS_cancel_key_s section as a template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind - the action check told me!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay format is weird - but that's what it wants.


/* API context */
H5TS_key_t H5TS_apictx_key_g
#ifdef H5_HAVE_WIN_THREADS
= TLS_OUT_OF_INDEXES
#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

Expand Down Expand Up @@ -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() */
Expand Down Expand Up @@ -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() */
Expand Down
2 changes: 1 addition & 1 deletion tools/test/h5dump/h5dumpgentest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down