ck_barrier: Just pass-through tournament barrier with only one participating thread.

ck_pring
Samy Al Bahra 11 years ago
parent edd12edbcc
commit b97b0021f9

@ -121,6 +121,7 @@ typedef struct ck_barrier_tournament_round ck_barrier_tournament_round_t;
struct ck_barrier_tournament { struct ck_barrier_tournament {
unsigned int tid; unsigned int tid;
unsigned int size;
struct ck_barrier_tournament_round **rounds; struct ck_barrier_tournament_round **rounds;
}; };
typedef struct ck_barrier_tournament ck_barrier_tournament_t; typedef struct ck_barrier_tournament ck_barrier_tournament_t;

@ -64,7 +64,7 @@ ck_barrier_tournament_init(struct ck_barrier_tournament *barrier,
unsigned int i, k, size, twok, twokm1, imod2k; unsigned int i, k, size, twok, twokm1, imod2k;
ck_pr_store_uint(&barrier->tid, 0); ck_pr_store_uint(&barrier->tid, 0);
size = ck_barrier_tournament_size(nthr); barrier->size = size = ck_barrier_tournament_size(nthr);
for (i = 0; i < nthr; ++i) { for (i = 0; i < nthr; ++i) {
/* The first role is always CK_BARRIER_TOURNAMENT_DROPOUT. */ /* The first role is always CK_BARRIER_TOURNAMENT_DROPOUT. */
@ -112,6 +112,9 @@ ck_barrier_tournament(struct ck_barrier_tournament *barrier,
struct ck_barrier_tournament_round **rounds = ck_pr_load_ptr(&barrier->rounds); struct ck_barrier_tournament_round **rounds = ck_pr_load_ptr(&barrier->rounds);
int round = 1; int round = 1;
if (barrier->size == 1)
return;
for (;; ++round) { for (;; ++round) {
switch (rounds[state->vpid][round].role) { switch (rounds[state->vpid][round].role) {
case CK_BARRIER_TOURNAMENT_BYE: case CK_BARRIER_TOURNAMENT_BYE:

Loading…
Cancel
Save