[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/03: blocks: correcting use of mutexes in
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/03: blocks: correcting use of mutexes in file_meta_sink. |
Date: |
Mon, 28 Jul 2014 18:42:30 +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 643ca3669b74c63578c64df7b7e1819ef0d6b9b7
Author: Tom Rondeau <address@hidden>
Date: Mon Jul 28 11:33:16 2014 -0400
blocks: correcting use of mutexes in file_meta_sink.
the gr::block class has a d_setlock mutex that's appropriate for this use
instead of creating another for the child class.
---
gr-blocks/lib/file_meta_sink_impl.cc | 6 +++---
gr-blocks/lib/file_meta_sink_impl.h | 2 --
gr-blocks/lib/file_meta_source_impl.cc | 8 ++++----
gr-blocks/lib/file_meta_source_impl.h | 1 -
4 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/gr-blocks/lib/file_meta_sink_impl.cc
b/gr-blocks/lib/file_meta_sink_impl.cc
index 06ac051..027d12f 100644
--- a/gr-blocks/lib/file_meta_sink_impl.cc
+++ b/gr-blocks/lib/file_meta_sink_impl.cc
@@ -171,7 +171,7 @@ namespace gr {
bool
file_meta_sink_impl::_open(FILE **fp, const char *filename)
{
- gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of
this function
+ gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of
this function
bool ret = true;
int fd;
@@ -201,7 +201,7 @@ namespace gr {
void
file_meta_sink_impl::close()
{
- gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of
this function
+ gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of
this function
update_last_header();
if(d_state == STATE_DETACHED) {
@@ -222,7 +222,7 @@ namespace gr {
file_meta_sink_impl::do_update()
{
if(d_updated) {
- gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of
this block
+ gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of
this block
if(d_state == STATE_DETACHED) {
if(d_hdr_fp)
fclose(d_hdr_fp);
diff --git a/gr-blocks/lib/file_meta_sink_impl.h
b/gr-blocks/lib/file_meta_sink_impl.h
index e454341..5e67872 100644
--- a/gr-blocks/lib/file_meta_sink_impl.h
+++ b/gr-blocks/lib/file_meta_sink_impl.h
@@ -25,7 +25,6 @@
#include <gnuradio/blocks/file_meta_sink.h>
#include <pmt/pmt.h>
-#include <gnuradio/thread/thread.h>
using namespace pmt;
@@ -51,7 +50,6 @@ namespace gr {
bool d_updated;
bool d_unbuffered;
- boost::mutex d_mutex;
FILE *d_new_fp, *d_new_hdr_fp;
FILE *d_fp, *d_hdr_fp;
meta_state_t d_state;
diff --git a/gr-blocks/lib/file_meta_source_impl.cc
b/gr-blocks/lib/file_meta_source_impl.cc
index 58be9ec..5686945 100644
--- a/gr-blocks/lib/file_meta_source_impl.cc
+++ b/gr-blocks/lib/file_meta_source_impl.cc
@@ -297,7 +297,7 @@ namespace gr {
bool
file_meta_source_impl::_open(FILE **fp, const char *filename)
{
- gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of
this function
+ gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of
this function
bool ret = true;
int fd;
@@ -326,7 +326,7 @@ namespace gr {
void
file_meta_source_impl::close()
{
- gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of
this function
+ gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of
this function
if(d_state == STATE_DETACHED) {
if(d_new_hdr_fp) {
fclose(d_new_hdr_fp);
@@ -345,7 +345,7 @@ namespace gr {
file_meta_source_impl::do_update()
{
if(d_updated) {
- gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of
this block
+ gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of
this block
if(d_state == STATE_DETACHED) {
if(d_hdr_fp)
fclose(d_hdr_fp);
@@ -403,7 +403,7 @@ namespace gr {
d_tags.pop_back();
}
- gr::thread::scoped_lock lock(d_mutex); // hold for the rest of this
function
+ gr::thread::scoped_lock lock(d_setlock); // hold for the rest of this
function
while(size) {
i = fread(out, d_itemsize, size, d_fp);
diff --git a/gr-blocks/lib/file_meta_source_impl.h
b/gr-blocks/lib/file_meta_source_impl.h
index 00d8d7e..bd7d3c1 100644
--- a/gr-blocks/lib/file_meta_source_impl.h
+++ b/gr-blocks/lib/file_meta_source_impl.h
@@ -50,7 +50,6 @@ namespace gr {
bool d_updated;
bool d_repeat;
- gr::thread::mutex d_mutex;
FILE *d_new_fp, *d_new_hdr_fp;
FILE *d_fp, *d_hdr_fp;
meta_state_t d_state;