summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2019-03-19 21:40:07 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2019-03-19 21:40:07 (GMT)
commitadb09288274ab1e622d691afd8e090c8f0ac92e0 (patch)
treeead24e8c6ef14085504c16b13281d380c604b6dd /src
parent93b72d60ab9c99898e40ecd03b0d5d3fb3830931 (diff)
downloadhdf5-adb09288274ab1e622d691afd8e090c8f0ac92e0.zip
hdf5-adb09288274ab1e622d691afd8e090c8f0ac92e0.tar.gz
hdf5-adb09288274ab1e622d691afd8e090c8f0ac92e0.tar.bz2
Remove thread-local copy of hyperslab operation generation value.
Diffstat (limited to 'src')
-rw-r--r--src/H5Shyper.c89
-rw-r--r--src/H5TS.c12
-rw-r--r--src/H5TSprivate.h1
3 files changed, 4 insertions, 98 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 478a0e2..17c3d65 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -83,24 +83,6 @@
(curr_span) = saved_next_span; \
} while(0)
-#ifdef H5_HAVE_THREADSAFE
-/*
- * The per-thread operation generation. pthread_once() initializes a special
- * key that will be used by all threads to create a stack specific to
- * each thread individually. The association of operation generations to threads
- * will be handled by the pthread library.
- *
- * In order for this macro to work, H5S_hyper_get_my_op_gen() must be preceeded
- * by "uint64_t *gen =".
- */
-#define H5S_hyper_get_my_op_gen() H5S__hyper_op_gen()
-#else /* H5_HAVE_THREADSAFE */
-/*
- * The current operation generation.
- */
-#define H5S_hyper_get_my_op_gen() (&H5S_hyper_op_gen_g)
-#endif /* H5_HAVE_THREADSAFE */
-
/******************/
/* Local Typedefs */
@@ -114,9 +96,6 @@ typedef hsize_t hbounds_t;
/********************/
/* Local Prototypes */
/********************/
-#ifdef H5_HAVE_THREADSAFE
-static uint64_t *H5S__hyper_op_gen(void);
-#endif /* H5_HAVE_THREADSAFE */
static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high,
H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
static H5S_hyper_span_info_t *H5S__hyper_new_span_info(unsigned rank);
@@ -285,10 +264,9 @@ H5FL_BARR_DEFINE_STATIC(H5S_hyper_span_info_t, hbounds_t, H5S_MAX_RANK * 2);
/* Declare extern free list to manage the H5S_sel_iter_t struct */
H5FL_EXTERN(H5S_sel_iter_t);
-#ifndef H5_HAVE_THREADSAFE
-static uint64_t H5S_hyper_op_gen_g = 1; /* Current operation generation */
- /* (Use '1' to avoid clashing with '0' value in newly allocated structs) */
-#endif /* H5_HAVE_THREADSAFE */
+/* Current operation generation */
+/* (Start with '1' to avoid clashing with '0' value in newly allocated structs) */
+static uint64_t H5S_hyper_op_gen_g = 1;
/* Uncomment this, to provide the debugging routines for printing selection info */
@@ -518,60 +496,6 @@ H5S__hyper_print_space_dfs(FILE *f, const H5S_t *space)
} /* end H5S__hyper_print_space_dfs() */
#endif /* H5S_HYPER_DEBUG */
-#ifdef H5_HAVE_THREADSAFE
-
-/*-------------------------------------------------------------------------
- * Function: H5S__hyper_op_gen
- *
- * Purpose: Support function for H5S_hyper_get_my_op_gen() to initialize and
- * acquire per-thread hyperslab operation generation.
- *
- * Return: Success: Non-NULL pointer to hyperslab operation generation for thread
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * January 19, 2019
- *
- *-------------------------------------------------------------------------
- */
-static uint64_t *
-H5S__hyper_op_gen(void)
-{
- uint64_t *op_gen = NULL;
-
- FUNC_ENTER_STATIC_NOERR
-
- op_gen = (uint64_t *)H5TS_get_thread_local_value(H5TS_hyper_op_gen_key_g);
-
- if(!op_gen) {
- /* No associated value with current thread - create one */
-#ifdef H5_HAVE_WIN_THREADS
- /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */
- op_gen = (uint64_t *)LocalAlloc(LPTR, sizeof(uint64_t));
-#else
- /* Use HDmalloc here since this has to match the HDfree in the
- * destructor and we want to avoid the codestack there.
- */
- op_gen = (uint64_t *)HDmalloc(sizeof(uint64_t));
-#endif /* H5_HAVE_WIN_THREADS */
- HDassert(op_gen);
-
- /* Reset the thread-specific info */
- /* (Use '1' to avoid clashing with '0' value in newly allocated structs) */
- *op_gen = 1;
-
- /* (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_hyper_op_gen_key_g, (void *)op_gen);
- } /* end if */
-
- /* Set return value */
- FUNC_LEAVE_NOAPI(op_gen)
-} /* end H5S__hyper_op_gen() */
-#endif /* H5_HAVE_THREADSAFE */
-
/*-------------------------------------------------------------------------
* Function: H5S__hyper_get_op_gen
@@ -591,14 +515,9 @@ H5S__hyper_op_gen(void)
uint64_t
H5S__hyper_get_op_gen(void)
{
- uint64_t *op_gen = H5S_hyper_get_my_op_gen(); /* Get the pointer to the hyperslab operation generation, for this thread */
-
FUNC_ENTER_PACKAGE_NOERR
- /* Check args */
- HDassert(op_gen);
-
- FUNC_LEAVE_NOAPI((*op_gen)++);
+ FUNC_LEAVE_NOAPI(H5S_hyper_op_gen_g++);
} /* end H5S__hyper_op_gen() */
diff --git a/src/H5TS.c b/src/H5TS.c
index f386421..10e14d5 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -35,7 +35,6 @@ H5TS_once_t H5TS_first_init_g = PTHREAD_ONCE_INIT;
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_hyper_op_gen_key_g;
H5TS_key_t H5TS_cancel_key_g;
@@ -114,9 +113,6 @@ H5TS_pthread_first_thread_init(void)
/* initialize key for thread-specific API contexts */
pthread_key_create(&H5TS_apictx_key_g, H5TS_key_destructor);
- /* initialize key for thread-specific hyperslab operation generation */
- pthread_key_create(&H5TS_hyper_op_gen_key_g, H5TS_key_destructor);
-
/* initialize key for thread cancellability mechanism */
pthread_key_create(&H5TS_cancel_key_g, H5TS_key_destructor);
}
@@ -366,9 +362,6 @@ H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
if(TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc()))
ret_value = FALSE;
- if(TLS_OUT_OF_INDEXES == (H5TS_hyper_op_gen_key_g = TlsAlloc()))
- ret_value = FALSE;
-
return ret_value;
} /* H5TS_win32_process_enter() */
#endif /* H5_HAVE_WIN_THREADS */
@@ -438,7 +431,6 @@ H5TS_win32_process_exit(void)
TlsFree(H5TS_funcstk_key_g);
#endif /* H5_HAVE_CODESTACK */
TlsFree(H5TS_apictx_key_g);
- TlsFree(H5TS_hyper_op_gen_key_g);
return;
} /* H5TS_win32_process_exit() */
@@ -487,10 +479,6 @@ H5TS_win32_thread_exit(void)
if(lpvData)
LocalFree((HLOCAL)lpvData);
- lpvData = TlsGetValue(H5TS_hyper_op_gen_key_g);
- if(lpvData)
- LocalFree((HLOCAL)lpvData);
-
return ret_value;
} /* H5TS_win32_thread_exit() */
#endif /* H5_HAVE_WIN_THREADS */
diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h
index 94791bc..9e093a6 100644
--- a/src/H5TSprivate.h
+++ b/src/H5TSprivate.h
@@ -110,7 +110,6 @@ extern H5TS_once_t H5TS_first_init_g;
extern H5TS_key_t H5TS_errstk_key_g;
extern H5TS_key_t H5TS_funcstk_key_g;
extern H5TS_key_t H5TS_apictx_key_g;
-extern H5TS_key_t H5TS_hyper_op_gen_key_g;
#if defined c_plusplus || defined __cplusplus
extern "C"