Flowgrind
Advanced TCP traffic generator
fg_barrier.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2014 Alexander Zimmermann <alexander.zimmermann@netapp.com>
8  * Copyright (C) 2010 Brent Priddy <brent.priddy@priddysoftware.com>
9  *
10  * This file is part of Flowgrind.
11  *
12  * Flowgrind is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * Flowgrind is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with Flowgrind. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef _FG_BARRIER_H_
28 #define _FG_BARRIER_H_
29 
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif /* HAVE_CONFIG_H */
33 
34 #include <pthread.h>
35 
38 
40 typedef struct {
42  pthread_mutex_t mutex;
44  pthread_cond_t cond;
46  int count;
48  int tripCount;
50 
65  const pthread_barrierattr_t *attr, unsigned count);
77 
89 
90 #endif /* _FG_BARRIER_H_ */
pthread_barrier_t::tripCount
int tripCount
Current number of threads waiting at the barrier.
Definition: fg_barrier.h:48
pthread_barrier_wait
int pthread_barrier_wait(pthread_barrier_t *barrier)
Synchronizes participating threads at the barrier referenced by barrier.
Definition: fg_barrier.c:80
pthread_barrier_t::cond
pthread_cond_t cond
Thread to suspend its execution until the condition is satisfied.
Definition: fg_barrier.h:44
pthread_barrier_destroy
int pthread_barrier_destroy(pthread_barrier_t *barrier)
Destroys the barrier referenced by barrier.
Definition: fg_barrier.c:64
pthread_barrier_init
int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned count)
Allocates resources required to use the barrier referenced by barrier.
Definition: fg_barrier.c:37
pthread_barrier_t::mutex
pthread_mutex_t mutex
Protect shared data structures from concurrent modifications.
Definition: fg_barrier.h:42
pthread_barrier_t
Object for barrier synchronization.
Definition: fg_barrier.h:40
config.h
pthread_barrier_t::count
int count
Required number of threads have to wait at the barrier.
Definition: fg_barrier.h:46
pthread_barrierattr_t
int pthread_barrierattr_t
Barrier attribute object.
Definition: fg_barrier.h:37