PostgreSQL Source Code: src/port/pthread_barrier_wait.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#include "c.h"
15
17
18int
20{
22
26 if ((error = pthread_cond_init(&barrier->cond, NULL)) != 0)
29 {
30 pthread_cond_destroy(&barrier->cond);
32 }
33
34 return 0;
35}
36
37int
39{
40 bool initial_sense;
41
43
44
47
48
50 {
54 pthread_cond_broadcast(&barrier->cond);
55
57 }
58
59
60 initial_sense = barrier->sense;
61 do
62 {
64 } while (barrier->sense == initial_sense);
65
67
68 return 0;
69}
70
71int
73{
74 pthread_cond_destroy(&barrier->cond);
75 pthread_mutex_destroy(&barrier->mutex);
76 return 0;
77}
Assert(PointerIsAligned(start, uint64))
#define PTHREAD_BARRIER_SERIAL_THREAD
static THREAD_BARRIER_T barrier
int pthread_mutex_unlock(pthread_mutex_t *mp)
int pthread_mutex_lock(pthread_mutex_t *mp)
int pthread_mutex_init(pthread_mutex_t *mp, void *attr)
int pthread_barrier_wait(pthread_barrier_t *barrier)
int pthread_barrier_init(pthread_barrier_t *barrier, const void *attr, int count)
int pthread_barrier_destroy(pthread_barrier_t *barrier)