Hello, I have HDF5 working under Windows, but it fails under Linux.
The function H5CX__pop_common fails (called from H5open) because “H5CX_node_t **head = H5CX_get_my_context();” returns as “head != null && *head == null”.
I tried this with H5_HAVE_THREADSAFE and without, with the same result.
When looking at “H5CX_get_my_context” I am unsure how this function would ever not return with “*head == null”.
I cleaned up the function for easier reference here.
static H5CX_node_t ** H5CX__get_context(void)
{
H5CX_node_t **ctx = NULL;
FUNC_ENTER_STATIC_NOERR
ctx = (H5CX_node_t **)H5TS_get_thread_local_value(H5TS_apictx_key_g);
if(!ctx) {
/* No associated value with current thread - create one */
ctx = (H5CX_node_t **)HDmalloc(sizeof(H5CX_node_t *));
HDassert(ctx);
/* Reset the thread-specific info */
*ctx = NULL;
/* (It's not necessary to release this in this API, it is
* released by the "key destructor" set up in the H5TS
* routines. See calls to pthread_key_create() in H5TS.c -QAK)
*/
H5TS_set_thread_local_value(H5TS_apictx_key_g, (void *)ctx);
} /* end if */
/* Set return value */
FUNC_LEAVE_NOAPI(ctx)
} /* end H5CX__get_context() */
So the function sets “*ctx = NULL;” and then calls “H5TS_set_thread_local_value” which compiles to “pthread_setspecific”, so it seems to me that “*ctx” will always be null.
Does anyone have more insight into this? Do I have to create this context explicitly?
Thank,
Daniel