summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-blocks/lib/stream_to_tagged_stream_impl.cc7
-rw-r--r--gr-blocks/lib/stream_to_tagged_stream_impl.h2
-rw-r--r--gr-fft/lib/fft.cc32
-rwxr-xr-xgr-uhd/apps/uhd_fft10
4 files changed, 49 insertions, 2 deletions
diff --git a/gr-blocks/lib/stream_to_tagged_stream_impl.cc b/gr-blocks/lib/stream_to_tagged_stream_impl.cc
index 58e1a9c5b0..f0de33a16f 100644
--- a/gr-blocks/lib/stream_to_tagged_stream_impl.cc
+++ b/gr-blocks/lib/stream_to_tagged_stream_impl.cc
@@ -84,6 +84,13 @@ namespace gr {
return noutput_items;
}
+ bool
+ stream_to_tagged_stream_impl::start()
+ {
+ d_next_tag_pos = 0;
+ return true;
+ }
+
} /* namespace blocks */
} /* namespace gr */
diff --git a/gr-blocks/lib/stream_to_tagged_stream_impl.h b/gr-blocks/lib/stream_to_tagged_stream_impl.h
index dc9c117765..586bd202fa 100644
--- a/gr-blocks/lib/stream_to_tagged_stream_impl.h
+++ b/gr-blocks/lib/stream_to_tagged_stream_impl.h
@@ -46,6 +46,8 @@ namespace gr {
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
+
+ bool start();
};
} // namespace blocks
diff --git a/gr-fft/lib/fft.cc b/gr-fft/lib/fft.cc
index 5af77d97eb..ef81583187 100644
--- a/gr-fft/lib/fft.cc
+++ b/gr-fft/lib/fft.cc
@@ -46,10 +46,12 @@ static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); }
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
+#include <boost/interprocess/sync/file_lock.hpp>
namespace fs = boost::filesystem;
namespace gr {
namespace fft {
+ static boost::mutex wisdom_thread_mutex;
gr_complex *
malloc_complex(int size)
@@ -92,6 +94,30 @@ namespace gr {
}
static void
+ lock_wisdom()
+ {
+ const std::string wisdom_lock_file = wisdom_filename() + ".lock";
+ int fd = open(wisdom_lock_file.c_str(),
+ O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK,
+ 0666);
+ if (fd < 0){
+ throw std::exception();
+ }
+ boost::interprocess::file_lock wisdom_lock(wisdom_lock_file.c_str());
+ wisdom_lock.lock();
+ wisdom_thread_mutex.lock();
+ }
+
+ static void
+ unlock_wisdom()
+ {
+ const std::string wisdom_lock_file = wisdom_filename() + ".lock";
+ boost::interprocess::file_lock wisdom_lock(wisdom_lock_file.c_str());
+ wisdom_lock.unlock();
+ wisdom_thread_mutex.unlock();
+ }
+
+ static void
import_wisdom()
{
const std::string filename = wisdom_filename ();
@@ -162,6 +188,7 @@ namespace gr {
d_nthreads = nthreads;
config_threading(nthreads);
+ lock_wisdom();
import_wisdom(); // load prior wisdom from disk
d_plan = fftwf_plan_dft_1d (fft_size,
@@ -175,6 +202,7 @@ namespace gr {
throw std::runtime_error ("fftwf_plan_dft_1d failed");
}
export_wisdom(); // store new wisdom to disk
+ unlock_wisdom();
}
fft_complex::~fft_complex()
@@ -233,6 +261,7 @@ namespace gr {
d_nthreads = nthreads;
config_threading(nthreads);
+ lock_wisdom();
import_wisdom(); // load prior wisdom from disk
d_plan = fftwf_plan_dft_r2c_1d (fft_size,
@@ -245,6 +274,7 @@ namespace gr {
throw std::runtime_error ("fftwf_plan_dft_r2c_1d failed");
}
export_wisdom(); // store new wisdom to disk
+ unlock_wisdom();
}
fft_real_fwd::~fft_real_fwd()
@@ -303,6 +333,7 @@ namespace gr {
d_nthreads = nthreads;
config_threading(nthreads);
+ lock_wisdom();
import_wisdom(); // load prior wisdom from disk
// FIXME If there's ever a chance that the planning functions
@@ -318,6 +349,7 @@ namespace gr {
throw std::runtime_error ("fftwf_plan_dft_c2r_1d failed");
}
export_wisdom (); // store new wisdom to disk
+ unlock_wisdom();
}
fft_real_rev::~fft_real_rev ()
diff --git a/gr-uhd/apps/uhd_fft b/gr-uhd/apps/uhd_fft
index 1f0cf1cda5..4cb5eed0d1 100755
--- a/gr-uhd/apps/uhd_fft
+++ b/gr-uhd/apps/uhd_fft
@@ -140,9 +140,15 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self._samp_rate__tool_bar.addWidget(self._samp_rate__line_edit)
self._samp_rate__line_edit.returnPressed.connect(
lambda: self.set_samp_rate(eng_notation.str_to_num(str(self._samp_rate__line_edit.text().toAscii()))))
- self.top_grid_layout.addWidget(self._samp_rate__tool_bar, 3,2,1,2)
+ self.top_grid_layout.addWidget(self._samp_rate__tool_bar, 3, 2, 1, 2)
# Gain:
- self._gain__range = Range(self.gain_range.start(), self.gain_range.stop(), self.gain_range.step(), self.gain, 200)
+ self._gain__range = Range(
+ self.gain_range.start(),
+ self.gain_range.stop(),
+ max(self.gain_range.step(), 1.0),
+ self.gain,
+ 200
+ )
self._gain__win = RangeWidget(self._gain__range, self.set_gain, "RX Gain", "counter_slider", float)
self.top_grid_layout.addWidget(self._gain__win, 2,0,1,4)
# Center frequency: