Changeset d453a4a


Ignore:
Timestamp:
Jan 9, 2010, 5:03:11 PM (14 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
7581185
Parents:
066433d
Message:

src/spectral/fft.c: lock fftw plan creation (closes #9), thanks to Hedde Bosman

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/fft.c

    r066433d rd453a4a  
    2828 * c++ projects can still use their own complex definition. */
    2929#include <fftw3.h>
     30#include <pthread.h>
    3031
    3132#ifdef HAVE_COMPLEX_H
     
    7374#endif /* HAVE_FFTW3F */
    7475
     76// a global mutex for FFTW thread safety
     77pthread_mutex_t aubio_fftw_mutex = PTHREAD_MUTEX_INITIALIZER;
     78
    7579struct _aubio_fft_t {
    7680  uint_t winsize;
     
    9195  s->compspec = new_fvec(winsize);
    9296  /* create plans */
     97  pthread_mutex_lock(&aubio_fftw_mutex);
    9398#ifdef HAVE_COMPLEX_H
    9499  s->fft_size = winsize/2 + 1;
     
    102107  s->pbw = fftw_plan_r2r_1d(winsize, s->specdata, s->out, FFTW_HC2R, FFTW_ESTIMATE);
    103108#endif
     109  pthread_mutex_unlock(&aubio_fftw_mutex);
    104110  for (i = 0; i < s->winsize; i++) {
    105111    s->in[i] = 0.;
Note: See TracChangeset for help on using the changeset viewer.