diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2014-04-04 20:51:30 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2014-04-04 20:51:30 (GMT) |
commit | b17ef126a75779f00ee4fef70a2b590b2c19fb4e (patch) | |
tree | 846887128b92979fd6e1c3cd84bb6a5c445e1068 /src/H5CS.c | |
parent | 79a891c2417859de411a36e25203499f1f0d4280 (diff) | |
download | hdf5-b17ef126a75779f00ee4fef70a2b590b2c19fb4e.zip hdf5-b17ef126a75779f00ee4fef70a2b590b2c19fb4e.tar.gz hdf5-b17ef126a75779f00ee4fef70a2b590b2c19fb4e.tar.bz2 |
[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)
Diffstat (limited to 'src/H5CS.c')
-rw-r--r-- | src/H5CS.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -83,12 +83,16 @@ H5CS_get_stack(void) fstack = H5TS_get_thread_local_value(H5TS_funcstk_key_g); if (!fstack) { - /* no associated value with current thread - create one */ - fstack = (H5CS_t *)HDmalloc(sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */ + /* No associated value with current thread - create one */ +#ifdef H5_HAVE_WIN_THREADS + fstack = (H5CS_t *)LocalAlloc(LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ +#else + fstack = (H5CS_t *)HDmalloc(sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */ +#endif /* H5_HAVE_WIN_THREADS */ HDassert(fstack); /* Set the thread-specific info */ - fstack->nused=0; + fstack->nused=0; /* (It's not necessary to release this in this API, it is * released by the "key destructor" set up in the H5TS |