diff options
author | David Young <dyoung@hdfgroup.org> | 2020-02-27 22:14:44 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-05-11 20:34:44 (GMT) |
commit | f0485413e02ebf1117e5b1725f32534e7e26b622 (patch) | |
tree | b8f0483f989ca5e3dc237cefb6176ea83c687262 | |
parent | c149f4ca16db6ae9538490041f3145d50585e65b (diff) | |
download | hdf5-f0485413e02ebf1117e5b1725f32534e7e26b622.zip hdf5-f0485413e02ebf1117e5b1725f32534e7e26b622.tar.gz hdf5-f0485413e02ebf1117e5b1725f32534e7e26b622.tar.bz2 |
Complete the comment on thread_main(), explaining why the barrier is used.
-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) |