Lines Matching refs:barrier

34 ck_barrier_mcs_init(struct ck_barrier_mcs *barrier, unsigned int nthr)
38 ck_pr_store_uint(&barrier->tid, 0);
46 barrier[i].havechild[j] = ((i << 2) + j < nthr - 1) ? ~0 : 0;
52 barrier[i].childnotready[j] = barrier[i].havechild[j];
56 barrier[i].parent = (i == 0) ?
57 &barrier[i].dummy :
58 &barrier[(i - 1) >> 2].childnotready[(i - 1) & 3];
61 barrier[i].children[0] = ((i << 1) + 1 >= nthr) ?
62 &barrier[i].dummy :
63 &barrier[(i << 1) + 1].parentsense;
65 barrier[i].children[1] = ((i << 1) + 2 >= nthr) ?
66 &barrier[i].dummy :
67 &barrier[(i << 1) + 2].parentsense;
69 barrier[i].parentsense = 0;
76 ck_barrier_mcs_subscribe(struct ck_barrier_mcs *barrier, struct ck_barrier_mcs_state *state)
80 state->vpid = ck_pr_faa_uint(&barrier->tid, 1);
112 ck_barrier_mcs(struct ck_barrier_mcs *barrier,
117 * Wait until all children have reached the barrier and are done waiting
120 while (ck_barrier_mcs_check_children(barrier[state->vpid].childnotready) == false)
123 /* Reinitialize for next barrier. */
124 ck_barrier_mcs_reinitialize_children(&barrier[state->vpid]);
126 /* Inform parent thread and its children have arrived at the barrier. */
127 ck_pr_store_uint(barrier[state->vpid].parent, 0);
129 /* Wait until parent indicates all threads have arrived at the barrier. */
131 while (ck_pr_load_uint(&barrier[state->vpid].parentsense) != state->sense)
135 /* Inform children of successful barrier. */
136 ck_pr_store_uint(barrier[state->vpid].children[0], state->sense);
137 ck_pr_store_uint(barrier[state->vpid].children[1], state->sense);