aboutsummaryrefslogblamecommitdiffstats
path: root/killbarriergroup.c
blob: f83317e64231ce0264d027cd5c6e812a746dcc1f (plain) (tree)




























                                                                           
/* 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
}