Merge pull request #1035 in HDFFV/hdf5 from fix_api_context_filter_plugin to develop

* commit '76cab1f5cb48af8398e1c09c15a974b1f8347da4':
  Fix non-threadsafe API context head pointer handling.
This commit is contained in:
Quincey Koziol 2018-04-18 22:53:18 -05:00
commit fa829e322e

View File

@ -61,7 +61,7 @@
/*
* The current API context.
*/
#define H5CX_get_my_context() (H5CX_head_g)
#define H5CX_get_my_context() (&H5CX_head_g)
#endif /* H5_HAVE_THREADSAFE */
/* Common macro for the duplicated code to retrieve properties from a property list */
@ -358,7 +358,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/*******************/
#ifndef H5_HAVE_THREADSAFE
static H5CX_node_t **H5CX_head_g = NULL; /* Pointer to head of context stack */
static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context stack */
#endif /* H5_HAVE_THREADSAFE */
/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
@ -391,13 +391,6 @@ H5CX__init_package(void)
FUNC_ENTER_STATIC
#ifndef H5_HAVE_THREADSAFE
/* Allocate the context stack head pointer */
if(NULL == (H5CX_head_g = (H5CX_node_t **)HDmalloc(sizeof(H5CX_node_t *))))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "can't allocate pointer to head of context stack")
*H5CX_head_g = NULL;
#endif /* H5_HAVE_THREADSAFE */
/* Reset the "default DXPL cache" information */
HDmemset(&H5CX_def_dxpl_cache, 0, sizeof(H5CX_dxpl_cache_t));
@ -546,8 +539,6 @@ H5CX_term_package(void)
HDfree(cnode);
#ifndef H5_HAVE_THREADSAFE
/* Release pointer to head of API context stack */
HDfree(H5CX_head_g);
H5CX_head_g = NULL;
#endif /* H5_HAVE_THREADSAFE */