summaryrefslogtreecommitdiffstats
path: root/src/H5TS.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-06 14:21:06 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-06 14:21:06 (GMT)
commit5e943e85e27645f03ec44fe36d007821bf29d6b6 (patch)
tree0ea16d3d7cbb1f20ed6aba5d132df311b19635a7 /src/H5TS.c
parentf6a5236e43ab8d461d472ecda9d70297fb7a53b5 (diff)
parent048ae59d2970dd21810577c999f756c028b6faaf (diff)
downloadhdf5-5e943e85e27645f03ec44fe36d007821bf29d6b6.zip
hdf5-5e943e85e27645f03ec44fe36d007821bf29d6b6.tar.gz
hdf5-5e943e85e27645f03ec44fe36d007821bf29d6b6.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '048ae59d2970dd21810577c999f756c028b6faaf': Correct errors with non-"instrumented library" builds (production & parallel, generally speaking). Update java error stack tests Revert using H5MF_sect_small_can_shrink and H5MF_sect_small_shrink for the file's free space manager (and add a comment about them). Add comment for the file flush when the file low / high bounds are changed after a file is open. Expanded comments abuot H5CX_t fields. Add an assert to verify that we don't write when between MPI_Barrier() calls during a flush. Add comments for internal structs. Remove redundant 'is_collective' parameter from H5CX_set_loc. Correct typo in comment. Revert some tangential code cleanups. Add API context source files to CMake configuration file. Corrections for parallel I/O & tests. Update handling of reporting for breaking collective I/O when the default DXPL is used. Update encoded DXPLs to reflect changes in properties. Correct typo for error checking malloc return value. Refactor H5CX code to reduce duplication. Cleanup API context function usage. Add API context interface and use it throughout the library.
Diffstat (limited to 'src/H5TS.c')
-rw-r--r--src/H5TS.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/H5TS.c b/src/H5TS.c
index a0ca134..d239e09 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -34,6 +34,7 @@ H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT;
#endif /* H5_HAVE_WIN_THREADS */
H5TS_key_t H5TS_errstk_key_g;
H5TS_key_t H5TS_funcstk_key_g;
+H5TS_key_t H5TS_apictx_key_g;
H5TS_key_t H5TS_cancel_key_g;
@@ -109,6 +110,9 @@ H5TS_pthread_first_thread_init(void)
/* initialize key for thread-specific function stacks */
pthread_key_create(&H5TS_funcstk_key_g, H5TS_key_destructor);
+ /* initialize key for thread-specific API contexts */
+ pthread_key_create(&H5TS_apictx_key_g, H5TS_key_destructor);
+
/* initialize key for thread cancellability mechanism */
pthread_key_create(&H5TS_cancel_key_g, H5TS_key_destructor);
}
@@ -262,8 +266,7 @@ H5TS_cancel_count_inc(void)
cancel_counter = (H5TS_cancel_t *)HDcalloc(1, sizeof(H5TS_cancel_t));
if (!cancel_counter) {
- H5E_push_stack(NULL, "H5TS_cancel_count_inc", __FILE__, __LINE__,
- H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed");
+ HERROR(H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed");
return FAIL;
}
@@ -356,6 +359,10 @@ H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
ret_value = FALSE;
#endif /* H5_HAVE_CODESTACK */
+ /* Set up thread local storage */
+ if(TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc()))
+ ret_value = FALSE;
+
return ret_value;
} /* H5TS_win32_process_enter() */
#endif /* H5_HAVE_WIN_THREADS */
@@ -426,6 +433,9 @@ H5TS_win32_process_exit(void)
TlsFree(H5TS_funcstk_key_g);
#endif /* H5_HAVE_CODESTACK */
+ /* Clean up per-process thread local storage */
+ TlsFree(H5TS_apictx_key_g);
+
return;
} /* H5TS_win32_process_exit() */
#endif /* H5_HAVE_WIN_THREADS */
@@ -469,6 +479,11 @@ H5TS_win32_thread_exit(void)
LocalFree((HLOCAL)lpvData);
#endif /* H5_HAVE_CODESTACK */
+ /* Clean up per-thread thread local storage */
+ lpvData = TlsGetValue(H5TS_apictx_key_g);
+ if(lpvData)
+ LocalFree((HLOCAL)lpvData);
+
return ret_value;
} /* H5TS_win32_thread_exit() */
#endif /* H5_HAVE_WIN_THREADS */