Lines Matching +full:software +full:- +full:locked
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
27 * Reusable 2 PHASE task barrier (rendez-vous point) implementation for N tasks.
28 * Based on the Little book of semaphores - https://greenteapress.com/wp/semaphores/
57 tb->n = 0; in task_barrier_init()
58 atomic_set(&tb->count, 0); in task_barrier_init()
59 sema_init(&tb->enter_turnstile, 0); in task_barrier_init()
60 sema_init(&tb->exit_turnstile, 0); in task_barrier_init()
65 tb->n++; in task_barrier_add_task()
70 tb->n--; in task_barrier_rem_task()
76 * When all thread passed this code the entry barrier is back to locked state.
80 if (atomic_inc_return(&tb->count) == tb->n) in task_barrier_enter()
81 task_barrier_signal_turnstile(&tb->enter_turnstile, tb->n); in task_barrier_enter()
83 down(&tb->enter_turnstile); in task_barrier_enter()
94 if (atomic_dec_return(&tb->count) == 0) in task_barrier_exit()
95 task_barrier_signal_turnstile(&tb->exit_turnstile, tb->n); in task_barrier_exit()
97 down(&tb->exit_turnstile); in task_barrier_exit()