diff options
author | David Young <dyoung@hdfgroup.org> | 2020-02-03 22:23:06 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-02-03 22:23:06 (GMT) |
commit | a20b68b25796d94f1159156acf97322326565c93 (patch) | |
tree | aa5e87ba08dc68f30ce5957879114c00389aaf1a /src/H5TS.c | |
parent | 65600cbd7229340d7f5ab86dd20b35ae2dabd1ad (diff) | |
download | hdf5-a20b68b25796d94f1159156acf97322326565c93.zip hdf5-a20b68b25796d94f1159156acf97322326565c93.tar.gz hdf5-a20b68b25796d94f1159156acf97322326565c93.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.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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; |