patch-gnuradio
[Top][All Lists]
Advanced

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

Re: [Patch-gnuradio] [PATCH] WAV sink: is now threadsafe; do_update() th


From: Tom Rondeau
Subject: Re: [Patch-gnuradio] [PATCH] WAV sink: is now threadsafe; do_update() therefore must be private
Date: Tue, 13 Dec 2011 21:10:09 -0500

On Mon, Dec 12, 2011 at 12:49 PM, Martin Braun <address@hidden> wrote:
---
 gnuradio-core/src/lib/io/gr_wavfile_sink.cc |    2 +-
 gnuradio-core/src/lib/io/gr_wavfile_sink.h  |   14 +++++++-------
 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 a96aadc..88b2323 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 5fd3eaa..6a6b7eb 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.
--
1.7.5.4

Martin,
So unfortunately, this constitutes and "API change" since you've modified the do_update function to be private instead of public. 

I've applied the patch to the next branch.

Thanks!
Tom


reply via email to

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