Loading...
Searching...
No Matches
pthread_barrier.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2014 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
18
19#include "mutex.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
31#define PTHREAD_PROCESS_SHARED (0)
38#define PTHREAD_PROCESS_PRIVATE (1)
39
49
56typedef struct
57{
60 volatile int count;
62
68typedef struct
69{
70 int pshared;
72
81 const pthread_barrierattr_t *attr,
82 unsigned int count);
83
92
100
108
116
124
133
134#ifdef __cplusplus
135}
136#endif
137
int16_t kernel_pid_t
Unique process identifier.
Definition sched.h:138
Mutex for thread synchronization.
int pthread_barrier_wait(pthread_barrier_t *barrier)
Waiting on a synchronization barrier.
int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
Initializes a pthread_barrier_t.
int pthread_barrierattr_init(pthread_barrierattr_t *attr)
Initialize a pthread_barrierattr_t.
int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
Set if the barrier should be shared with child processes.
int pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
Destroy a pthread_barrierattr_t.
int pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, int *pshared)
Returns whether the barrier attribute was set to be shared.
struct pthread_barrier_waiting_node pthread_barrier_waiting_node_t
Internal structure to store the list of waiting threads.
int pthread_barrier_destroy(pthread_barrier_t *barrier)
Destroys a pthread_barrier_t.
Mutex structure.
Definition mutex.h:39
A synchronization barrier.
struct pthread_barrier_waiting_node * next
The first waiting thread.
mutex_t mutex
Mutex to unlock to wake the thread up.
volatile int count
Wait for N more threads before waking everyone up.
Internal structure to store the list of waiting threads.
volatile int cont
0 = spurious wake up, 1 = wake up
struct pthread_barrier_waiting_node * next
The next waiting thread.
kernel_pid_t pid
The current thread to wake up.
Details for a pthread_barrier_t.
int pshared
See pthread_barrierattr_setpshared() and pthread_barrierattr_getpshared().