summaryrefslogtreecommitdiffstats
path: root/src/H5TS.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-02-03 22:23:06 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2020-05-06 20:37:42 (GMT)
commit524af38af8877957308832dbe346aa84c7dea356 (patch)
treecc458a85aa3703e9caa8db0f5ce050615429f6ea /src/H5TS.c
parentbb3e1a5cafd0c35358e341836b758ea3b747f495 (diff)
downloadhdf5-524af38af8877957308832dbe346aa84c7dea356.zip
hdf5-524af38af8877957308832dbe346aa84c7dea356.tar.gz
hdf5-524af38af8877957308832dbe346aa84c7dea356.tar.bz2
Change thread IDs to uint64_t from unsigned long, per Quincey's suggestion.
Fix a typo in the H5TS_thread_init() comment and reword some ID properties.
Diffstat (limited to 'src/H5TS.c')
-rw-r--r--src/H5TS.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/H5TS.c b/src/H5TS.c
index aa60eba..7a801e2 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -47,12 +47,12 @@ typedef struct _tid h5_tid_t;
struct _tid {
h5_tid_t *next;
- unsigned long id;
+ uint64_t id;
};
/* Pointer to first free thread ID record or NULL. */
static h5_tid_t *tid_next_free = NULL;
-static unsigned long tid_next_id = 0;
+static uint64_t tid_next_id = 0;
/* Mutual exclusion for access to tid_next_free and tid_next_id. */
static pthread_mutex_t tid_mtx;
@@ -118,18 +118,18 @@ tid_init(void)
pthread_key_create(&tid_key, tid_destructor);
}
-/* Return an integer identifier, ID, for the current thread satisfies the
+/* Return an integer identifier, ID, for the current thread satisfying the
* following properties:
*
- * 1 1 <= ID <= ULONG_MAX
- * 2 The ID is constant over the thread's lifetime.
+ * 1 1 <= ID <= UINT64_MAX
+ * 2 ID is constant over the thread's lifetime.
* 3 No two threads share an ID during their lifetimes.
* 4 A thread's ID is available for reuse as soon as it is joined.
*
* ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not built
* with thread safety or if an error prevents it from assigning an ID.
*/
-unsigned long
+uint64_t
H5TS_thread_id(void)
{
h5_tid_t *tid = pthread_getspecific(tid_key);
@@ -149,7 +149,7 @@ H5TS_thread_id(void)
pthread_mutex_lock(&tid_mtx);
if ((tid = tid_next_free) != NULL)
tid_next_free = tid->next;
- else if (tid_next_id != ULONG_MAX) {
+ else if (tid_next_id != UINT64_MAX) {
tid = &proto_tid;
tid->id = ++tid_next_id;
}
@@ -641,7 +641,7 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata)
#else /* H5_HAVE_THREADSAFE */
-unsigned long
+uint64_t
H5TS_thread_id(void)
{
return 0;