diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2011-12-06 02:52:15 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2011-12-06 02:52:15 (GMT) |
commit | 354adf632e861e3a0e94af461d9d97a38e969484 (patch) | |
tree | aabbca2de6991855c476360149ed674495accbc6 /src/H5TS.c | |
parent | 8478d450161ed5b52ee0f58873a5596633e3c094 (diff) | |
download | hdf5-354adf632e861e3a0e94af461d9d97a38e969484.zip hdf5-354adf632e861e3a0e94af461d9d97a38e969484.tar.gz hdf5-354adf632e861e3a0e94af461d9d97a38e969484.tar.bz2 |
[svn-r21816] Fix for JIRA HDFFV-7780
Updates Windows thread-safe code in H5TS.c to use _beginthread instead of CreateThread.
Tested on 64-bit Windows 7 with Visual Studio 2010 using CMake. Both 32- and 64-bit builds were tested.
Diffstat (limited to 'src/H5TS.c')
-rw-r--r-- | src/H5TS.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -393,13 +393,22 @@ H5TS_cancel_count_dec(void) *-------------------------------------------------------------------------- */ H5TS_thread_t -H5TS_create_thread(void * func, H5TS_attr_t * attr, void*udata) +H5TS_create_thread(void *func, H5TS_attr_t *attr, void *udata) { H5TS_thread_t ret_value; #ifdef H5_HAVE_WIN_THREADS - ret_value = CreateThread(NULL, 0, func, udata, 0, NULL); + /* When calling C runtime functions, you have to use _beginthread or + * _beginthreadex instead of CreateThread. Threads created with + * CreateThread risk being killed in low-memory situations. + * We use _beginthread instead of _begintheadex because the latter + * requires a stdcall function (and we don't need the more advanced + * features it exposes). + * + * NOTE: No error checks here! ret_value will be -1L on errors. + */ + ret_value = _beginthread(func, 0 /* stack size */, udata); #else /* H5_HAVE_WIN_THREADS */ |