ergo
barrier.h
Go to the documentation of this file.
1/* Ergo, version 3.8.2, a program for linear scaling electronic structure
2 * calculations.
3 * Copyright (C) 2023 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
4 * and Anastasia Kruchinina.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Primary academic reference:
20 * Ergo: An open-source program for linear-scaling electronic structure
21 * calculations,
22 * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
23 * Kruchinina,
24 * SoftwareX 7, 107 (2018),
25 * <http://dx.doi.org/10.1016/j.softx.2018.03.005>
26 *
27 * For further information about Ergo, see <http://www.ergoscf.org>.
28 */
29
30#if !defined(_ERGO_BARRIER_H_)
31#define _ERGO_BARRIER_H_
36#if !defined(HAS_PTHREAD_BARRIER)
37
38#ifdef __cplusplus
39#define EXTERN_C extern "C"
40#else
41#define EXTERN_C extern
42#endif
43
44#if !defined(PTHREAD_BARRIER_SERIAL_THREAD)
45#define PTHREAD_BARRIER_SERIAL_THREAD -1
46#endif
47
48typedef struct ergo_barrier {
49 pthread_mutex_t barrierMutex;
50 pthread_cond_t conditionVar;
53 int cycle;
55
57 const void * attr_ignored,
58 unsigned int count);
59
62
63#else /* HAS_PTHREAD_BARRIER */
64#define ergo_barrier_t pthread_barrier_t
65#define ergo_barrier_init pthread_barrier_init
66#define ergo_barrier_destroy pthread_barrier_destroy
67#define ergo_barrier_wait pthread_barrier_wait
68#endif /* HAS_PTHREAD_BARRIER */
69
70#endif /* _ERGO_BARRIER_H_ */
EXTERN_C int ergo_barrier_wait(ergo_barrier_t *__barrier)
Definition: barrier.c:68
EXTERN_C int ergo_barrier_init(ergo_barrier_t *barrier, const void *attr_ignored, unsigned int count)
Definition: barrier.c:44
EXTERN_C int ergo_barrier_destroy(ergo_barrier_t *__barrier)
Definition: barrier.c:58
#define EXTERN_C
Definition: barrier.h:41
struct ergo_barrier ergo_barrier_t
Definition: barrier.h:48
int initCount
Definition: barrier.h:51
int cycle
Definition: barrier.h:53
pthread_mutex_t barrierMutex
Definition: barrier.h:49
int currCount
Definition: barrier.h:52
pthread_cond_t conditionVar
Definition: barrier.h:50