00001 /* Ergo, version 3.7, a program for linear scaling electronic structure 00002 * calculations. 00003 * Copyright (C) 2018 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, 00004 * and Anastasia Kruchinina. 00005 * 00006 * This program is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * Primary academic reference: 00020 * Ergo: An open-source program for linear-scaling electronic structure 00021 * calculations, 00022 * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia 00023 * Kruchinina, 00024 * SoftwareX 7, 107 (2018), 00025 * <http://dx.doi.org/10.1016/j.softx.2018.03.005> 00026 * 00027 * For further information about Ergo, see <http://www.ergoscf.org>. 00028 */ 00029 00030 #if !defined(_ERGO_BARRIER_H_) 00031 #define _ERGO_BARRIER_H_ 00032 00036 #if !defined(HAS_PTHREAD_BARRIER) 00037 00038 #ifdef __cplusplus 00039 #define EXTERN_C extern "C" 00040 #else 00041 #define EXTERN_C extern 00042 #endif 00043 00044 #if !defined(PTHREAD_BARRIER_SERIAL_THREAD) 00045 #define PTHREAD_BARRIER_SERIAL_THREAD -1 00046 #endif 00047 00048 typedef struct ergo_barrier { 00049 pthread_mutex_t barrierMutex; 00050 pthread_cond_t conditionVar; 00051 int initCount; 00052 int currCount; 00053 int cycle; 00054 } ergo_barrier_t; 00055 00056 EXTERN_C int ergo_barrier_init(ergo_barrier_t * barrier, 00057 const void * attr_ignored, 00058 unsigned int count); 00059 00060 EXTERN_C int ergo_barrier_destroy (ergo_barrier_t *__barrier); 00061 EXTERN_C int ergo_barrier_wait (ergo_barrier_t *__barrier); 00062 00063 #else /* HAS_PTHREAD_BARRIER */ 00064 #define ergo_barrier_t pthread_barrier_t 00065 #define ergo_barrier_init pthread_barrier_init 00066 #define ergo_barrier_destroy pthread_barrier_destroy 00067 #define ergo_barrier_wait pthread_barrier_wait 00068 #endif /* HAS_PTHREAD_BARRIER */ 00069 00070 #endif /* _ERGO_BARRIER_H_ */
1.6.1