[svn-r24961] Updates to Win32 thread-local storage cleanup when the thread-safe library is built on Windows. Previously, thread-local storage was not cleaned up, causing resource leaks.
Fixes HDFFV-8518, HDFFV-8699
As a part of these changes, the thread-safe + static library options are declared unsupported since the solution relies on DllMain. A solution for the static library is probably doable, but requires much more complicated surgery and has been deferred to HDF5 1.8.14.
Tested on:
64-bit Windows 7 using VS 2012 (changes only affect Windows)
This commit is contained in:
@@ -363,8 +363,12 @@ H5E_get_stack(void)
|
||||
estack = (H5E_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g);
|
||||
|
||||
if(!estack) {
|
||||
/* no associated value with current thread - create one */
|
||||
estack = (H5E_t *)H5FL_MALLOC(H5E_t);
|
||||
/* No associated value with current thread - create one */
|
||||
#ifdef H5_HAVE_WIN_THREADS
|
||||
estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */
|
||||
#else
|
||||
estack = (H5E_t *)H5FL_MALLOC(sizeof(H5E_t));
|
||||
#endif /* H5_HAVE_WIN_THREADS */
|
||||
HDassert(estack);
|
||||
|
||||
/* Set the thread-specific info */
|
||||
|
||||
Reference in New Issue
Block a user