#include <stdio.h>
#include <cassert>
#include <stdexcept>
-#include <boost/thread.hpp>
-typedef boost::mutex::scoped_lock scoped_lock;
-static boost::mutex s_planning_mutex;
+boost::mutex &
+gri_fft_planner::mutex()
+{
+ static boost::mutex s_planning_mutex;
+
+ return s_planning_mutex;
+}
static char *
wisdom_filename ()
gri_fft_complex::gri_fft_complex (int fft_size, bool forward)
{
// Hold global mutex during plan construction and destruction.
- scoped_lock lock(s_planning_mutex);
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
assert (sizeof (fftwf_complex) == sizeof (gr_complex));
gri_fft_complex::~gri_fft_complex ()
{
// Hold global mutex during plan construction and destruction.
- scoped_lock lock(s_planning_mutex);
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
fftwf_destroy_plan ((fftwf_plan) d_plan);
fftwf_free (d_inbuf);
gri_fft_real_fwd::gri_fft_real_fwd (int fft_size)
{
// Hold global mutex during plan construction and destruction.
- scoped_lock lock(s_planning_mutex);
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
assert (sizeof (fftwf_complex) == sizeof (gr_complex));
gri_fft_real_fwd::~gri_fft_real_fwd ()
{
// Hold global mutex during plan construction and destruction.
- scoped_lock lock(s_planning_mutex);
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
fftwf_destroy_plan ((fftwf_plan) d_plan);
fftwf_free (d_inbuf);
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2003,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
*/
#include <gr_complex.h>
+#include <boost/thread.hpp>
+
+/*!
+ * \brief Export reference to planner mutex for those apps that
+ * want to use FFTW w/o using the gri_fftw* classes.
+ */
+class gri_fft_planner {
+public:
+ typedef boost::mutex::scoped_lock scoped_lock;
+ /*!
+ * Return reference to planner mutex
+ */
+ static boost::mutex &mutex();
+};
/*!
* \brief FFT: complex in, complex out
* \ingroup dft
*/
-
class gri_fft_complex {
int d_fft_size;
gr_complex *d_inbuf;