LAL  7.5.0.1-ec27e42
FFTWMutex.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Bernd Machenschalk, Jolien Creighton
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19 
20 #include <lal/FFTWMutex.h>
21 
22 #if defined(LAL_PTHREAD_LOCK) && defined(LAL_FFTW3_ENABLED)
23 #include <pthread.h>
24 static pthread_mutex_t lalFFTWMutex = PTHREAD_MUTEX_INITIALIZER;
25 #endif
26 
27 
28 /**
29  * Aquire LAL's FFTW wisdom lock. This lock must be held when creating or
30  * destroying FFTW plans. This function is a no-op if LAL has been
31  * compiled without pthread support or with an FFT backend other than FFTW.
32  *
33  * See also: XLALFFTWWisdomUnlock()
34  */
35 
37 {
38 #if defined(LAL_PTHREAD_LOCK) && defined(LAL_FFTW3_ENABLED)
39  pthread_mutex_lock( &lalFFTWMutex );
40 #endif
41 }
42 
43 
44 /**
45  * Release LAL's FFTW wisdom lock. This function is a no-op if LAL has
46  * been compiled without pthread support or with an FFT backend other than
47  * FFTW.
48  *
49  * See also: XLALFFTWWisdomLock()
50  */
51 
53 {
54 #if defined(LAL_PTHREAD_LOCK) && defined(LAL_FFTW3_ENABLED)
55  pthread_mutex_unlock( &lalFFTWMutex );
56 #endif
57 }
void XLALFFTWWisdomLock(void)
Aquire LAL's FFTW wisdom lock.
Definition: FFTWMutex.c:36
void XLALFFTWWisdomUnlock(void)
Release LAL's FFTW wisdom lock.
Definition: FFTWMutex.c:52
#define pthread_mutex_lock(pmut)
Definition: LALMalloc.c:237
#define pthread_mutex_unlock(pmut)
Definition: LALMalloc.c:238