diff options
Diffstat (limited to '')
-rw-r--r-- | killbarriergroup.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/killbarriergroup.c b/killbarriergroup.c new file mode 100644 index 0000000..f83317e --- /dev/null +++ b/killbarriergroup.c @@ -0,0 +1,29 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +void +killbarriergroup(struct barrier_group *group, struct global_data *global) +{ +#ifndef SINGLE_THREADED + size_t i; + + if (!group->nthreads) + return; + + global->action = NULL; + for (i = 0; i < group->nthreads; i++) + group->threads[i].global = global; + barrierwait(&group->barrier); + + for (i = 0; i < group->nthreads; i++) + if ((errno = pthread_join(group->threads[i].thread, NULL))) + weprintf("pthread_join:"); + pthread_barrier_destroy(&group->barrier); + + free(group->threads); +#else + (void) group; + (void) global; +#endif +} |