-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbarrier.h
More file actions
27 lines (21 loc) · 698 Bytes
/
barrier.h
File metadata and controls
27 lines (21 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/****************************************************************************
FILE : barrier.h
SUBJECT : Interface to the barrier abstract data type.
PROGRAMMER : (C) Copyright 2010 by Peter C. Chapin <pcc482719@gmail.com>
****************************************************************************/
#ifndef BARRIER_H
#define BARRIER_H
#include <pthread.h>
typedef struct {
pthread_mutex_t lock;
pthread_cond_t all_released;
pthread_cond_t not_enough;
int max;
int count;
int releasing;
int wait_needed;
} barrier_t;
void barrier_init( barrier_t *b, int limit );
void barrier_destroy( barrier_t *b );
void barrier_wait( barrier_t *b );
#endif