Synchronization barriers. More...
Synchronization barriers.
Definition in file pthread_barrier.h.
#include "mutex.h"
Go to the source code of this file.
Data Structures | |
struct | pthread_barrier_waiting_node |
Internal structure to store the list of waiting threads. More... | |
struct | pthread_barrier_t |
A synchronization barrier. More... | |
struct | pthread_barrierattr_t |
Details for a pthread_barrier_t. More... | |
#define | PTHREAD_PROCESS_SHARED (0) |
Share the structure with child processes (default). More... | |
#define | PTHREAD_PROCESS_PRIVATE (1) |
Don't share the structure with child processes. More... | |
typedef struct pthread_barrier_waiting_node | pthread_barrier_waiting_node_t |
Internal structure to store the list of waiting threads. | |
int | pthread_barrier_init (pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count) |
Initializes a pthread_barrier_t. More... | |
int | pthread_barrier_destroy (pthread_barrier_t *barrier) |
Destroys a pthread_barrier_t. More... | |
int | pthread_barrier_wait (pthread_barrier_t *barrier) |
Waiting on a synchronization barrier. More... | |
int | pthread_barrierattr_init (pthread_barrierattr_t *attr) |
Initialize a pthread_barrierattr_t. More... | |
int | pthread_barrierattr_destroy (pthread_barrierattr_t *attr) |
Destroy a pthread_barrierattr_t. More... | |
int | pthread_barrierattr_getpshared (const pthread_barrierattr_t *attr, int *pshared) |
Returns whether the barrier attribute was set to be shared. More... | |
int | pthread_barrierattr_setpshared (pthread_barrierattr_t *attr, int pshared) |
Set if the barrier should be shared with child processes. More... | |
#define PTHREAD_PROCESS_PRIVATE (1) |
Don't share the structure with child processes.
pshared
does not change anything. Definition at line 39 of file pthread_barrier.h.
#define PTHREAD_PROCESS_SHARED (0) |
Share the structure with child processes (default).
pshared
does not change anything. Definition at line 32 of file pthread_barrier.h.
int pthread_barrier_destroy | ( | pthread_barrier_t * | barrier | ) |
Destroys a pthread_barrier_t.
To use the barrier again you will need to call pthread_barrier_init() again. Destroying a barrier while threads are currently waiting for it causes indefined behavior.
barrier | Barrier to destoy |
int pthread_barrier_init | ( | pthread_barrier_t * | barrier, |
const pthread_barrierattr_t * | attr, | ||
unsigned int | count | ||
) |
Initializes a pthread_barrier_t.
barrier | Datum to initialize |
attr | (unused) |
count | Number of thread to wait for |
int pthread_barrier_wait | ( | pthread_barrier_t * | barrier | ) |
Waiting on a synchronization barrier.
The barrier need to be initialized with pthread_barrier_init().
barrier | Barrier to wait for |
int pthread_barrierattr_destroy | ( | pthread_barrierattr_t * | attr | ) |
Destroy a pthread_barrierattr_t.
This function does nothing.
attr | Datum to destroy |
int pthread_barrierattr_getpshared | ( | const pthread_barrierattr_t * | attr, |
int * | pshared | ||
) |
Returns whether the barrier attribute was set to be shared.
attr | Barrier attribute to read |
pshared | The value previously stored with pthread_barrierattr_setpshared(). |
int pthread_barrierattr_init | ( | pthread_barrierattr_t * | attr | ) |
Initialize a pthread_barrierattr_t.
A zeroed out datum is initialized.
attr | Datum to initialize. |
int pthread_barrierattr_setpshared | ( | pthread_barrierattr_t * | attr, |
int | pshared | ||
) |
Set if the barrier should be shared with child processes.
Since RIOT is a single process OS, pthread_barrier_init() will ignore the value.
attr | Attribute set for pthread_barrier_init() |
pshared | Either PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED |