summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authorMartin Braun2011-12-13 21:08:15 -0500
committerTom Rondeau2011-12-13 21:08:15 -0500
commit73538627386205c25b87f7657ab6e8dd774f4cd3 (patch)
tree6703ea6c5e79c5534ccd7460c3e6ea114ce6f2d5 /gnuradio-core
parent027413aa028afb66da739918bc4ed641600e767f (diff)
downloadgnuradio-73538627386205c25b87f7657ab6e8dd774f4cd3.tar.gz
gnuradio-73538627386205c25b87f7657ab6e8dd774f4cd3.tar.bz2
gnuradio-73538627386205c25b87f7657ab6e8dd774f4cd3.zip
core: WAV sink is now threadsafe; do_update() therefore must be private.
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_sink.cc2
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_sink.h14
2 files changed, 8 insertions, 8 deletions
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
index a96aadc72..88b232343 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
@@ -184,6 +184,7 @@ gr_wavfile_sink::work (int noutput_items,
int nwritten;
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
do_update(); // update: d_fp is reqd
if (!d_fp) // drop output on the floor
return noutput_items;
@@ -254,7 +255,6 @@ gr_wavfile_sink::do_update()
return;
}
- gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
if (d_fp) {
close_wav();
}
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.h b/gnuradio-core/src/lib/io/gr_wavfile_sink.h
index 5fd3eaadc..6a6b7ebf0 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_sink.h
+++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.h
@@ -86,6 +86,13 @@ private:
short convert_to_short(float sample);
/*!
+ * \brief If any file changes have occurred, update now. This is called
+ * internally by work() and thus doesn't usually need to be called by
+ * hand.
+ */
+ void do_update();
+
+ /*!
* \brief Writes information to the WAV header which is not available
* a-priori (chunk size etc.) and closes the file. Not thread-safe and
* assumes d_fp is a valid file pointer, should thus only be called by
@@ -108,13 +115,6 @@ public:
void close();
/*!
- * \brief If any file changes have occurred, update now. This is called
- * internally by work() and thus doesn't usually need to be called by
- * hand.
- */
- void do_update();
-
- /*!
* \brief Set the sample rate. This will not affect the WAV file
* currently opened. Any following open() calls will use this new
* sample rate.