Lines Matching +full:sense +full:-

2  * Copyright 2011-2015 Samy Al Bahra.
43 if (queue->head != NULL) { in ck_barrier_combining_queue_dequeue()
44 front = queue->head; in ck_barrier_combining_queue_dequeue()
45 queue->head = queue->head->next; in ck_barrier_combining_queue_dequeue()
58 tnode->parent = parent; in ck_barrier_combining_insert()
65 parent->k++; in ck_barrier_combining_insert()
80 node_value->next = NULL; in ck_barrier_combining_queue_enqueue()
81 if (queue->head == NULL) { in ck_barrier_combining_queue_enqueue()
82 queue->head = queue->tail = node_value; in ck_barrier_combining_queue_enqueue()
86 queue->tail->next = node_value; in ck_barrier_combining_queue_enqueue()
87 queue->tail = node_value; in ck_barrier_combining_queue_enqueue()
103 tnode->k = nthr; in ck_barrier_combining_group_init()
104 tnode->count = 0; in ck_barrier_combining_group_init()
105 tnode->sense = 0; in ck_barrier_combining_group_init()
106 tnode->left = tnode->right = NULL; in ck_barrier_combining_group_init()
110 * tree. The use of a spinlock is excusable as this is a one-time in ck_barrier_combining_group_init()
113 ck_spinlock_fas_lock(&root->mutex); in ck_barrier_combining_group_init()
114 ck_barrier_combining_queue_enqueue(&queue, root->root); in ck_barrier_combining_group_init()
119 if (node->left == NULL) { in ck_barrier_combining_group_init()
120 ck_barrier_combining_insert(node, tnode, &node->left); in ck_barrier_combining_group_init()
125 if (node->right == NULL) { in ck_barrier_combining_group_init()
126 ck_barrier_combining_insert(node, tnode, &node->right); in ck_barrier_combining_group_init()
134 ck_barrier_combining_queue_enqueue(&queue, node->left); in ck_barrier_combining_group_init()
135 ck_barrier_combining_queue_enqueue(&queue, node->right); in ck_barrier_combining_group_init()
139 ck_spinlock_fas_unlock(&root->mutex); in ck_barrier_combining_group_init()
148 init_root->k = 0; in ck_barrier_combining_init()
149 init_root->count = 0; in ck_barrier_combining_init()
150 init_root->sense = 0; in ck_barrier_combining_init()
151 init_root->parent = init_root->left = init_root->right = NULL; in ck_barrier_combining_init()
152 ck_spinlock_fas_init(&root->mutex); in ck_barrier_combining_init()
153 root->root = init_root; in ck_barrier_combining_init()
160 unsigned int sense) in ck_barrier_combining_aux() argument
165 * Otherwise, it spins on this group's sense. in ck_barrier_combining_aux()
167 if (ck_pr_faa_uint(&tnode->count, 1) == tnode->k - 1) { in ck_barrier_combining_aux()
172 if (tnode->parent != NULL) in ck_barrier_combining_aux()
173 ck_barrier_combining_aux(barrier, tnode->parent, sense); in ck_barrier_combining_aux()
178 * sense. Order of these operations is not important since we assume a static in ck_barrier_combining_aux()
181 * tnode->count is equivalent to tnode->k if and only if that many threads in ck_barrier_combining_aux()
184 ck_pr_store_uint(&tnode->count, 0); in ck_barrier_combining_aux()
186 ck_pr_store_uint(&tnode->sense, ~tnode->sense); in ck_barrier_combining_aux()
188 while (sense != ck_pr_load_uint(&tnode->sense)) in ck_barrier_combining_aux()
202 ck_barrier_combining_aux(barrier, tnode, state->sense); in ck_barrier_combining()
204 /* Reverse the execution context's sense for the next barrier. */ in ck_barrier_combining()
205 state->sense = ~state->sense; in ck_barrier_combining()