summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink.cc3
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.cc6
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.h7
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.i5
4 files changed, 21 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/io/gr_file_sink.cc b/gnuradio-core/src/lib/io/gr_file_sink.cc
index d40235fab..d2c43aac7 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_file_sink.cc
@@ -70,5 +70,8 @@ gr_file_sink::work (int noutput_items,
nwritten += count;
inbuf += count * d_itemsize;
}
+ if (d_unbuffered)
+ fflush (d_fp);
+
return nwritten;
}
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.cc b/gnuradio-core/src/lib/io/gr_file_sink_base.cc
index 5ddeeb4d5..c43304b0d 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink_base.cc
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.cc
@@ -118,3 +118,9 @@ gr_file_sink_base::do_update()
d_updated = false;
}
}
+
+void
+gr_file_sink_base::set_unbuffered(bool unbuffered)
+{
+ d_unbuffered = unbuffered;
+}
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.h b/gnuradio-core/src/lib/io/gr_file_sink_base.h
index 0c028d7fd..7b96cdb7f 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink_base.h
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.h
@@ -37,6 +37,7 @@ class gr_file_sink_base
bool d_updated; // is there a new FILE pointer?
bool d_is_binary;
boost::mutex d_mutex;
+ bool d_unbuffered;
protected:
gr_file_sink_base(const char *filename, bool is_binary);
@@ -61,6 +62,12 @@ class gr_file_sink_base
* \brief if we've had an update, do it now.
*/
void do_update();
+
+
+ /*!
+ * \brief turn on unbuffered writes for slower outputs
+ */
+ void set_unbuffered(bool unbuffered);
};
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.i b/gnuradio-core/src/lib/io/gr_file_sink_base.i
index 05a3353bb..ed4342482 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink_base.i
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.i
@@ -43,4 +43,9 @@ class gr_file_sink_base
* \brief if we've had an update, do it now.
*/
void do_update();
+
+ /*!
+ *\brief turn on unbuffered mode for slow outputs
+ */
+ void set_unbuffered(bool unbuffered);
};