fftw3 0.0.1

Bindings to FFTW3: the Fastest Fourier Transform in the West.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Some functions in FFTW are not thread-safe, and one should ensure
//! that only one thread is executing these at a time. This module
//! provides a lock for this purpose.

use sync::mutex::{StaticMutex, MUTEX_INIT};

/// Hold this lock when doing anything thread-unsafe with FFTW.
pub static LOCK: StaticMutex = MUTEX_INIT;

/// Run the given closure inside the critical section of the FFTW
/// lock.
pub fn run<A>(f: || -> A) -> A {
    let _g = LOCK.lock();
    f()
}