aboutsummaryrefslogtreecommitdiffstats
path: root/barriersend.c
blob: a947357a8ffc1542d516014991fd2cf1e12960fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* See LICENSE file for copyright and license details. */
#include "common.h"


void
barriersend(struct barrier_group *group, struct global_data *global, void (*action)(struct algorithm *, struct global_data *))
{
	size_t index;
	global->action = action;
	if (group->nthreads)
		barrierwait(&group->barrier);
	for (index = 0; index < global->nalgorithms; index += group->nthreads + 1U)
		(*action)(&global->algorithms[index], global);
	if (group->nthreads)
		barrierwait(&group->barrier);
}