diff options
Diffstat (limited to 'src/H5E.c')
-rw-r--r-- | src/H5E.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -193,19 +193,19 @@ void *H5E_auto_data_g = NULL; * *------------------------------------------------------------------------- */ -H5E_t *H5E_get_stack() { - H5E_t *estack; +H5E_t *H5E_get_stack(void) +{ + H5E_t *estack = pthread_getspecific(H5TS_errstk_key_g); + + if (!estack) { + /* no associated value with current thread - create one */ + estack = (H5E_t *)H5MM_malloc(sizeof(H5E_t)); + pthread_setspecific(H5TS_errstk_key_g, (void *)estack); + } - if ((estack = pthread_getspecific(H5TS_errstk_key_g))!=NULL) { - return estack; - } else { - /* no associated value with current thread - create one */ - estack = (H5E_t *)malloc(sizeof(H5E_t)); - pthread_setspecific(H5TS_errstk_key_g, (void *)estack); return estack; - } } -#endif +#endif /* H5_HAVE_THREADSAFE */ /*------------------------------------------------------------------------- |