commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 03/03: qtgui: replaced use of local mutex w


From: git
Subject: [Commit-gnuradio] [gnuradio] 03/03: qtgui: replaced use of local mutex with d_setlock from gr::block.
Date: Mon, 28 Jul 2014 18:42:31 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch maint
in repository gnuradio.

commit c1fb14af7182a2be871118a475614559b4e89b90
Author: Tom Rondeau <address@hidden>
Date:   Mon Jul 28 11:43:12 2014 -0400

    qtgui: replaced use of local mutex with d_setlock from gr::block.
    
    Partial response to issue #706.
---
 gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h |  2 -
 gr-qtgui/lib/SpectrumGUIClass.cc                   | 60 +++++++++++-----------
 gr-qtgui/lib/ber_sink_b_impl.h                     |  3 --
 gr-qtgui/lib/freq_sink_c_impl.cc                   |  4 +-
 gr-qtgui/lib/freq_sink_c_impl.h                    |  3 --
 gr-qtgui/lib/freq_sink_f_impl.cc                   |  4 +-
 gr-qtgui/lib/freq_sink_f_impl.h                    |  3 --
 gr-qtgui/lib/histogram_sink_f_impl.cc              |  4 +-
 gr-qtgui/lib/histogram_sink_f_impl.h               |  3 --
 gr-qtgui/lib/number_sink_impl.cc                   |  4 +-
 gr-qtgui/lib/number_sink_impl.h                    |  3 --
 gr-qtgui/lib/time_raster_sink_b_impl.h             |  1 -
 gr-qtgui/lib/time_raster_sink_f_impl.h             |  1 -
 gr-qtgui/lib/time_sink_c_impl.cc                   | 10 ++--
 gr-qtgui/lib/time_sink_c_impl.h                    |  3 --
 gr-qtgui/lib/time_sink_f_impl.cc                   | 10 ++--
 gr-qtgui/lib/time_sink_f_impl.h                    |  3 --
 gr-qtgui/lib/waterfall_sink_c_impl.cc              |  8 ++-
 gr-qtgui/lib/waterfall_sink_c_impl.h               |  1 -
 gr-qtgui/lib/waterfall_sink_f_impl.cc              |  4 ++
 gr-qtgui/lib/waterfall_sink_f_impl.h               |  1 -
 21 files changed, 59 insertions(+), 76 deletions(-)

diff --git a/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h 
b/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h
index 2fb7044..acdcaa4 100644
--- a/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h
+++ b/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h
@@ -23,7 +23,6 @@
 #ifndef SPECTRUM_GUI_CLASS_HPP
 #define SPECTRUM_GUI_CLASS_HPP
 
-#include <gnuradio/thread/thread.h>
 #include <qwidget.h>
 #include <qapplication.h>
 #include <qlabel.h>
@@ -112,7 +111,6 @@ protected:
 
 private:
 
-  gr::thread::mutex d_mutex;
   int64_t _dataPoints;
   std::string _title;
   double _centerFrequency;
diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
index 5272d8a..b5bf1a2 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -84,7 +84,7 @@ SpectrumGUIClass::openSpectrumWindow(QWidget* parent,
                                     const bool frequency, const bool waterfall,
                                     const bool time, const bool constellation)
 {
-  d_mutex.lock();
+  d_setlock.lock();
 
   if(!_windowOpennedFlag) {
 
@@ -114,7 +114,7 @@ SpectrumGUIClass::openSpectrumWindow(QWidget* parent,
 
     qApp->processEvents();
   }
-  d_mutex.unlock();
+  d_setlock.unlock();
 
 
   setDisplayTitle(_title);
@@ -168,7 +168,7 @@ SpectrumGUIClass::setDisplayTitle(const std::string 
newString)
 bool
 SpectrumGUIClass::getWindowOpenFlag()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   bool returnFlag = false;
   returnFlag =  _windowOpennedFlag;
   return returnFlag;
@@ -178,7 +178,7 @@ SpectrumGUIClass::getWindowOpenFlag()
 void
 SpectrumGUIClass::setWindowOpenFlag(const bool newFlag)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _windowOpennedFlag = newFlag;
 }
 
@@ -187,7 +187,7 @@ SpectrumGUIClass::setFrequencyRange(const double centerFreq,
                                    const double startFreq,
                                    const double stopFreq)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _centerFrequency = centerFreq;
   _startFrequency = startFreq;
   _stopFrequency = stopFreq;
@@ -201,7 +201,7 @@ SpectrumGUIClass::setFrequencyRange(const double centerFreq,
 double
 SpectrumGUIClass::getStartFrequency()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   double returnValue = 0.0;
   returnValue =  _startFrequency;
   return returnValue;
@@ -210,7 +210,7 @@ SpectrumGUIClass::getStartFrequency()
 double
 SpectrumGUIClass::getStopFrequency()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   double returnValue = 0.0;
   returnValue =  _stopFrequency;
   return returnValue;
@@ -219,7 +219,7 @@ SpectrumGUIClass::getStopFrequency()
 double
 SpectrumGUIClass::getCenterFrequency()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   double returnValue = 0.0;
   returnValue =  _centerFrequency;
   return returnValue;
@@ -237,7 +237,7 @@ SpectrumGUIClass::updateWindow(const bool updateDisplayFlag,
                               const gr::high_res_timer_type timestamp,
                               const bool lastOfMultipleFFTUpdateFlag)
 {
-  //gr::thread::scoped_lock lock(d_mutex);
+  //gr::thread::scoped_lock lock(d_setlock);
   int64_t bufferSize = inputBufferSize;
   bool repeatDataFlag = false;
   if(bufferSize > _dataPoints){
@@ -317,7 +317,7 @@ SpectrumGUIClass::updateWindow(const bool updateDisplayFlag,
 float
 SpectrumGUIClass::getPowerValue()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   float returnValue = 0;
   returnValue = _powerValue;
   return returnValue;
@@ -326,14 +326,14 @@ SpectrumGUIClass::getPowerValue()
 void
 SpectrumGUIClass::setPowerValue(const float value)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _powerValue = value;
 }
 
 int
 SpectrumGUIClass::getWindowType()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   int returnValue = 0;
   returnValue = _windowType;
   return returnValue;
@@ -342,7 +342,7 @@ SpectrumGUIClass::getWindowType()
 void
 SpectrumGUIClass::setWindowType(const int newType)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _windowType = newType;
 }
 
@@ -357,7 +357,7 @@ SpectrumGUIClass::getFFTSize()
 int
 SpectrumGUIClass::getFFTSizeIndex()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   int fftsize = getFFTSize();
   switch(fftsize) {
   case(1024): return 0; break;
@@ -373,14 +373,14 @@ SpectrumGUIClass::getFFTSizeIndex()
 void
 SpectrumGUIClass::setFFTSize(const int newSize)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _fftSize = newSize;
 }
 
 gr::high_res_timer_type
 SpectrumGUIClass::getLastGUIUpdateTime()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   gr::high_res_timer_type returnValue;
   returnValue = _lastGUIUpdateTime;
   return returnValue;
@@ -389,14 +389,14 @@ SpectrumGUIClass::getLastGUIUpdateTime()
 void
 SpectrumGUIClass::setLastGUIUpdateTime(const gr::high_res_timer_type newTime)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _lastGUIUpdateTime = newTime;
 }
 
 unsigned int
 SpectrumGUIClass::getPendingGUIUpdateEvents()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   unsigned int returnValue = 0;
   returnValue = _pendingGUIUpdateEventsCount;
   return returnValue;
@@ -405,14 +405,14 @@ SpectrumGUIClass::getPendingGUIUpdateEvents()
 void
 SpectrumGUIClass::incrementPendingGUIUpdateEvents()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _pendingGUIUpdateEventsCount++;
 }
 
 void
 SpectrumGUIClass::decrementPendingGUIUpdateEvents()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   if(_pendingGUIUpdateEventsCount > 0){
     _pendingGUIUpdateEventsCount--;
   }
@@ -421,7 +421,7 @@ SpectrumGUIClass::decrementPendingGUIUpdateEvents()
 void
 SpectrumGUIClass::resetPendingGUIUpdateEvents()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _pendingGUIUpdateEventsCount = 0;
 }
 
@@ -429,14 +429,14 @@ SpectrumGUIClass::resetPendingGUIUpdateEvents()
 QWidget*
 SpectrumGUIClass::qwidget()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   return (QWidget*)_spectrumDisplayForm;
 }
 
 void
 SpectrumGUIClass::setTimeDomainAxis(double min, double max)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _spectrumDisplayForm->setTimeDomainAxis(min, max);
 }
 
@@ -444,14 +444,14 @@ void
 SpectrumGUIClass::setConstellationAxis(double xmin, double xmax,
                                       double ymin, double ymax)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _spectrumDisplayForm->setConstellationAxis(xmin, xmax, ymin, ymax);
 }
 
 void
 SpectrumGUIClass::setConstellationPenSize(int size)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _spectrumDisplayForm->setConstellationPenSize(size);
 }
 
@@ -459,14 +459,14 @@ SpectrumGUIClass::setConstellationPenSize(int size)
 void
 SpectrumGUIClass::setFrequencyAxis(double min, double max)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _spectrumDisplayForm->setFrequencyAxis(min, max);
 }
 
 void
 SpectrumGUIClass::setUpdateTime(double t)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _updateTime = t;
   _spectrumDisplayForm->setUpdateTime(_updateTime);
 }
@@ -474,21 +474,21 @@ SpectrumGUIClass::setUpdateTime(double t)
 void
 SpectrumGUIClass::enableRFFreq(bool en)
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   _spectrumDisplayForm->toggleRFFrequencies(en);
 }
 
 bool
 SpectrumGUIClass::checkClicked()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   return _spectrumDisplayForm->checkClicked();
 }
 
 float
 SpectrumGUIClass::getClickedFreq()
 {
-  gr::thread::scoped_lock lock(d_mutex);
+  gr::thread::scoped_lock lock(d_setlock);
   return _spectrumDisplayForm->getClickedFreq();
 }
 
diff --git a/gr-qtgui/lib/ber_sink_b_impl.h b/gr-qtgui/lib/ber_sink_b_impl.h
index 9ab61e6..5ae6376 100644
--- a/gr-qtgui/lib/ber_sink_b_impl.h
+++ b/gr-qtgui/lib/ber_sink_b_impl.h
@@ -25,7 +25,6 @@
 
 #include <gnuradio/qtgui/ber_sink_b.h>
 #include <gnuradio/high_res_timer.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/qtgui/constellationdisplayform.h>
 
 namespace gr {
@@ -36,8 +35,6 @@ namespace gr {
     private:
       void initialize();
 
-      gr::thread::mutex d_mutex;
-
       std::vector<double*> d_esno_buffers;
       std::vector<double*> d_ber_buffers;
 
diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc
index 9f4a86f..11e8fc3 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.cc
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -409,6 +409,8 @@ namespace gr {
     void
     freq_sink_c_impl::windowreset()
     {
+      gr::thread::scoped_lock lock(d_setlock);
+
       filter::firdes::win_type newwintype;
       newwintype = d_main_gui->getFFTWindowType();
       if(d_wintype != newwintype) {
@@ -429,7 +431,7 @@ namespace gr {
     void
     freq_sink_c_impl::fftresize()
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       int newfftsize = d_main_gui->getFFTSize();
       d_fftavg = d_main_gui->getFFTAverage();
diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h
index e435cc6..dc985c1 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.h
+++ b/gr-qtgui/lib/freq_sink_c_impl.h
@@ -27,7 +27,6 @@
 #include <gnuradio/filter/firdes.h>
 #include <gnuradio/fft/fft.h>
 #include <gnuradio/high_res_timer.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/qtgui/freqdisplayform.h>
 
 namespace gr {
@@ -40,8 +39,6 @@ namespace gr {
 
       void initialize();
 
-      gr::thread::mutex d_mutex;
-
       int d_fftsize;
       float d_fftavg;
       filter::firdes::win_type d_wintype;
diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc
index 77eede0..c0a29be 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.cc
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -410,7 +410,7 @@ namespace gr {
     void
     freq_sink_f_impl::windowreset()
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       filter::firdes::win_type newwintype;
       newwintype = d_main_gui->getFFTWindowType();
@@ -432,7 +432,7 @@ namespace gr {
     void
     freq_sink_f_impl::fftresize()
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       int newfftsize = d_main_gui->getFFTSize();
       d_fftavg = d_main_gui->getFFTAverage();
diff --git a/gr-qtgui/lib/freq_sink_f_impl.h b/gr-qtgui/lib/freq_sink_f_impl.h
index 8a821f8..9c4e1e3 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.h
+++ b/gr-qtgui/lib/freq_sink_f_impl.h
@@ -27,7 +27,6 @@
 #include <gnuradio/filter/firdes.h>
 #include <gnuradio/fft/fft.h>
 #include <gnuradio/high_res_timer.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/qtgui/freqdisplayform.h>
 
 namespace gr {
@@ -40,8 +39,6 @@ namespace gr {
 
       void initialize();
 
-      gr::thread::mutex d_mutex;
-
       int d_fftsize;
       float d_fftavg;
       filter::firdes::win_type d_wintype;
diff --git a/gr-qtgui/lib/histogram_sink_f_impl.cc 
b/gr-qtgui/lib/histogram_sink_f_impl.cc
index 923ea73..56a4177 100644
--- a/gr-qtgui/lib/histogram_sink_f_impl.cc
+++ b/gr-qtgui/lib/histogram_sink_f_impl.cc
@@ -278,7 +278,7 @@ namespace gr {
     void
     histogram_sink_f_impl::set_nsamps(const int newsize)
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       if(newsize != d_size) {
        // Resize residbuf and replace data
@@ -302,7 +302,7 @@ namespace gr {
     void
     histogram_sink_f_impl::set_bins(const int bins)
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
       d_bins = bins;
       d_main_gui->setNumBins(d_bins);
     }
diff --git a/gr-qtgui/lib/histogram_sink_f_impl.h 
b/gr-qtgui/lib/histogram_sink_f_impl.h
index a3cb03e..a5409a2 100644
--- a/gr-qtgui/lib/histogram_sink_f_impl.h
+++ b/gr-qtgui/lib/histogram_sink_f_impl.h
@@ -25,7 +25,6 @@
 
 #include <gnuradio/qtgui/histogram_sink_f.h>
 #include <gnuradio/qtgui/histogramdisplayform.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/high_res_timer.h>
 
 namespace gr {
@@ -36,8 +35,6 @@ namespace gr {
     private:
       void initialize();
 
-      gr::thread::mutex d_mutex;
-
       int d_size;
       int d_bins;
       double d_xmin, d_xmax;
diff --git a/gr-qtgui/lib/number_sink_impl.cc b/gr-qtgui/lib/number_sink_impl.cc
index 2c31b60..4e513d5 100644
--- a/gr-qtgui/lib/number_sink_impl.cc
+++ b/gr-qtgui/lib/number_sink_impl.cc
@@ -257,7 +257,7 @@ namespace gr {
     void
     number_sink_impl::reset()
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
       _reset();
     }
 
@@ -288,7 +288,7 @@ namespace gr {
                           gr_vector_const_void_star &input_items,
                           gr_vector_void_star &output_items)
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       _gui_update_trigger();
 
diff --git a/gr-qtgui/lib/number_sink_impl.h b/gr-qtgui/lib/number_sink_impl.h
index 0f4fd48..13fc5ef 100644
--- a/gr-qtgui/lib/number_sink_impl.h
+++ b/gr-qtgui/lib/number_sink_impl.h
@@ -26,7 +26,6 @@
 #include <gnuradio/qtgui/number_sink.h>
 #include <gnuradio/qtgui/numberdisplayform.h>
 #include <gnuradio/filter/single_pole_iir.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/high_res_timer.h>
 
 namespace gr {
@@ -37,8 +36,6 @@ namespace gr {
     private:
       void initialize();
 
-      gr::thread::mutex d_mutex;
-
       size_t d_itemsize;
       float d_average;
       graph_t d_type;
diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.h 
b/gr-qtgui/lib/time_raster_sink_b_impl.h
index bd568e9..ba4b282 100644
--- a/gr-qtgui/lib/time_raster_sink_b_impl.h
+++ b/gr-qtgui/lib/time_raster_sink_b_impl.h
@@ -27,7 +27,6 @@
 #include <gnuradio/filter/firdes.h>
 #include <gnuradio/fft/fft.h>
 #include <gnuradio/high_res_timer.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/qtgui/timerasterdisplayform.h>
 
 namespace gr {
diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.h 
b/gr-qtgui/lib/time_raster_sink_f_impl.h
index 1e0dcf8..66f4465 100644
--- a/gr-qtgui/lib/time_raster_sink_f_impl.h
+++ b/gr-qtgui/lib/time_raster_sink_f_impl.h
@@ -27,7 +27,6 @@
 #include <gnuradio/filter/firdes.h>
 #include <gnuradio/fft/fft.h>
 #include <gnuradio/high_res_timer.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/qtgui/timerasterdisplayform.h>
 
 namespace gr {
diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc
index 0eb999b..664c164 100644
--- a/gr-qtgui/lib/time_sink_c_impl.cc
+++ b/gr-qtgui/lib/time_sink_c_impl.cc
@@ -231,7 +231,7 @@ namespace gr {
                                        float delay, int channel,
                                        const std::string &tag_key)
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       d_trigger_mode = mode;
       d_trigger_slope = slope;
@@ -311,7 +311,7 @@ namespace gr {
     time_sink_c_impl::set_nsamps(const int newsize)
     {
       if(newsize != d_size) {
-        gr::thread::scoped_lock lock(d_mutex);
+        gr::thread::scoped_lock lock(d_setlock);
 
        // Set new size and reset buffer index
        // (throws away any currently held data, but who cares?)
@@ -342,7 +342,7 @@ namespace gr {
     void
     time_sink_c_impl::set_samp_rate(const double samp_rate)
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
       d_samp_rate = samp_rate;
       d_main_gui->setSampleRate(d_samp_rate);
     }
@@ -404,7 +404,7 @@ namespace gr {
     void
     time_sink_c_impl::reset()
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
       _reset();
     }
 
@@ -583,7 +583,7 @@ namespace gr {
       _npoints_resize();
       _gui_update_trigger();
 
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       int nfill = d_end - d_index;                 // how much room left in 
buffers
       int nitems = std::min(noutput_items, nfill); // num items we can put in 
buffers
diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h
index c3c5bde..4e6ffb3 100644
--- a/gr-qtgui/lib/time_sink_c_impl.h
+++ b/gr-qtgui/lib/time_sink_c_impl.h
@@ -25,7 +25,6 @@
 
 #include <gnuradio/qtgui/time_sink_c.h>
 #include <gnuradio/qtgui/timedisplayform.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/high_res_timer.h>
 
 namespace gr {
@@ -36,8 +35,6 @@ namespace gr {
     private:
       void initialize();
 
-      gr::thread::mutex d_mutex;
-
       int d_size, d_buffer_size;
       double d_samp_rate;
       std::string d_name;
diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc
index 0a8a26f..b444d78 100644
--- a/gr-qtgui/lib/time_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_sink_f_impl.cc
@@ -233,7 +233,7 @@ namespace gr {
                                        float delay, int channel,
                                        const std::string &tag_key)
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       d_trigger_mode = mode;
       d_trigger_slope = slope;
@@ -313,7 +313,7 @@ namespace gr {
     time_sink_f_impl::set_nsamps(const int newsize)
     {
       if(newsize != d_size) {
-        gr::thread::scoped_lock lock(d_mutex);
+        gr::thread::scoped_lock lock(d_setlock);
 
        // Set new size and reset buffer index
        // (throws away any currently held data, but who cares?)
@@ -344,7 +344,7 @@ namespace gr {
     void
     time_sink_f_impl::set_samp_rate(const double samp_rate)
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
       d_samp_rate = samp_rate;
       d_main_gui->setSampleRate(d_samp_rate);
     }
@@ -406,7 +406,7 @@ namespace gr {
     void
     time_sink_f_impl::reset()
     {
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
       _reset();
     }
 
@@ -579,7 +579,7 @@ namespace gr {
       _npoints_resize();
       _gui_update_trigger();
 
-      gr::thread::scoped_lock lock(d_mutex);
+      gr::thread::scoped_lock lock(d_setlock);
 
       int nfill = d_end - d_index;                 // how much room left in 
buffers
       int nitems = std::min(noutput_items, nfill); // num items we can put in 
buffers
diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h
index 32e860a..6b3252c 100644
--- a/gr-qtgui/lib/time_sink_f_impl.h
+++ b/gr-qtgui/lib/time_sink_f_impl.h
@@ -25,7 +25,6 @@
 
 #include <gnuradio/qtgui/time_sink_f.h>
 #include <gnuradio/qtgui/timedisplayform.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/high_res_timer.h>
 
 namespace gr {
@@ -36,8 +35,6 @@ namespace gr {
     private:
       void initialize();
 
-      gr::thread::mutex d_mutex;
-
       int d_size, d_buffer_size;
       double d_samp_rate;
       std::string d_name;
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc 
b/gr-qtgui/lib/waterfall_sink_c_impl.cc
index 6c1583b..5e39352 100644
--- a/gr-qtgui/lib/waterfall_sink_c_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc
@@ -54,8 +54,8 @@ namespace gr {
                                                 int nconnections,
                                                 QWidget *parent)
       : sync_block("waterfall_sink_c",
-                     io_signature::make(1, nconnections, sizeof(gr_complex)),
-                     io_signature::make(0, 0, 0)),
+                   io_signature::make(1, nconnections, sizeof(gr_complex)),
+                   io_signature::make(0, 0, 0)),
        d_fftsize(fftsize), d_fftavg(1.0),
        d_wintype((filter::firdes::win_type)(wintype)),
        d_center_freq(fc), d_bandwidth(bw), d_name(name),
@@ -372,6 +372,8 @@ namespace gr {
     void
     waterfall_sink_c_impl::windowreset()
     {
+      gr::thread::scoped_lock lock(d_setlock);
+
       filter::firdes::win_type newwintype;
       newwintype = d_main_gui->getFFTWindowType();
       if(d_wintype != newwintype) {
@@ -392,6 +394,8 @@ namespace gr {
     void
     waterfall_sink_c_impl::fftresize()
     {
+      gr::thread::scoped_lock lock(d_setlock);
+
       int newfftsize = d_main_gui->getFFTSize();
       d_fftavg = d_main_gui->getFFTAverage();
 
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.h 
b/gr-qtgui/lib/waterfall_sink_c_impl.h
index ecff5a9..d0e7eb1 100644
--- a/gr-qtgui/lib/waterfall_sink_c_impl.h
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.h
@@ -27,7 +27,6 @@
 #include <gnuradio/filter/firdes.h>
 #include <gnuradio/fft/fft.h>
 #include <gnuradio/high_res_timer.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/qtgui/waterfalldisplayform.h>
 
 namespace gr {
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc 
b/gr-qtgui/lib/waterfall_sink_f_impl.cc
index 22771e1..5667acf 100644
--- a/gr-qtgui/lib/waterfall_sink_f_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc
@@ -374,6 +374,8 @@ namespace gr {
     void
     waterfall_sink_f_impl::windowreset()
     {
+      gr::thread::scoped_lock lock(d_setlock);
+
       filter::firdes::win_type newwintype;
       newwintype = d_main_gui->getFFTWindowType();
       if(d_wintype != newwintype) {
@@ -394,6 +396,8 @@ namespace gr {
     void
     waterfall_sink_f_impl::fftresize()
     {
+      gr::thread::scoped_lock lock(d_setlock);
+
       int newfftsize = d_fftsize;
 
       if(newfftsize != d_fftsize) {
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.h 
b/gr-qtgui/lib/waterfall_sink_f_impl.h
index 86cf0dc..d783f31 100644
--- a/gr-qtgui/lib/waterfall_sink_f_impl.h
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.h
@@ -27,7 +27,6 @@
 #include <gnuradio/filter/firdes.h>
 #include <gnuradio/fft/fft.h>
 #include <gnuradio/high_res_timer.h>
-#include <gnuradio/thread/thread.h>
 #include <gnuradio/qtgui/waterfalldisplayform.h>
 
 namespace gr {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]