diff options
author | David Young <dyoung@hdfgroup.org> | 2020-02-27 22:14:44 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-02-27 22:14:44 (GMT) |
commit | 803d805c74466a9d736455930b17de2d9f5cb02d (patch) | |
tree | 3fccf966bbe9b5f8fb46ac8107e0a77bb7c22e5f /test/thread_id.c | |
parent | 4be589813a8fc5e2c5313464b088d7d3c31a754d (diff) | |
download | hdf5-803d805c74466a9d736455930b17de2d9f5cb02d.zip hdf5-803d805c74466a9d736455930b17de2d9f5cb02d.tar.gz hdf5-803d805c74466a9d736455930b17de2d9f5cb02d.tar.bz2 |
Complete the comment on thread_main(), explaining why the barrier is used.
Diffstat (limited to 'test/thread_id.c')
-rw-r--r-- | test/thread_id.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/thread_id.c b/test/thread_id.c index e3cf42e..818ab4a 100644 --- a/test/thread_id.c +++ b/test/thread_id.c @@ -226,7 +226,15 @@ atomic_printf(const char *fmt, ...) /* Each thread runs this routine. The routine fetches the current * thread's ID, makes sure that it is in the expected range, makes * sure that in this round of testing, no two threads shared the - * same ID, + * same ID, and checks that each thread's ID is constant over its lifetime. + * + * main() checks that every ID in [1, NTHREADS] is used in each round + * of testing. All NTHREADS threads synchronize on a barrier after each + * has fetched its ID. The barrier guarantees that all threads' lifetimes + * overlap at least momentarily, so the IDs will be unique, and there + * will be NTHREADS of them. Further, since thread IDs are assigned + * starting with 1, and the number of threads with IDs alive never exceeds + * NTHREADS, the least ID has to be 1 and the greatest, NTHREADS. */ static void * thread_main(void H5_ATTR_UNUSED *arg) |