diff options
author | David Young <dyoung@hdfgroup.org> | 2020-02-27 22:14:44 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-05-20 14:31:55 (GMT) |
commit | 4bbd9649c0334cc02fbcc10c6804ff2b5ba272f9 (patch) | |
tree | 9ac8bb2d9506659edcc3d52aef7deb66dfb969ca /test | |
parent | 4562a584afc798e834bd6d51a94e90519669b574 (diff) | |
download | hdf5-4bbd9649c0334cc02fbcc10c6804ff2b5ba272f9.zip hdf5-4bbd9649c0334cc02fbcc10c6804ff2b5ba272f9.tar.gz hdf5-4bbd9649c0334cc02fbcc10c6804ff2b5ba272f9.tar.bz2 |
Complete the comment on thread_main(), explaining why the barrier is used.
Diffstat (limited to 'test')
-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) |