[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 48/50: controlport: better controlport prob
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 48/50: controlport: better controlport probe mutex handling. |
Date: |
Wed, 15 Apr 2015 21:07:58 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit c7b7e577c6a196c79c99582ae664fbf25e022ab4
Author: Nate Goergen <address@hidden>
Date: Fri Mar 20 17:02:27 2015 -0400
controlport: better controlport probe mutex handling.
---
gnuradio-runtime/include/gnuradio/rpcbufferedget.h | 35 +++++++++++++---------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/gnuradio-runtime/include/gnuradio/rpcbufferedget.h
b/gnuradio-runtime/include/gnuradio/rpcbufferedget.h
index 5d2b529..ebd740b 100644
--- a/gnuradio-runtime/include/gnuradio/rpcbufferedget.h
+++ b/gnuradio-runtime/include/gnuradio/rpcbufferedget.h
@@ -25,34 +25,41 @@
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
+#include <stdio.h>
template<typename TdataType>
class rpcbufferedget {
public:
rpcbufferedget(const unsigned int init_buffer_size = 4096) :
- data_needed(false), data_ready(), buffer_lock(), buffer(init_buffer_size)
{;}
+ d_data_needed(false), d_data_ready(), d_buffer_lock(),
d_buffer(init_buffer_size) {;}
- ~rpcbufferedget() {;}
+ ~rpcbufferedget() {
+ d_data_ready.notify_all();
+ }
void offer_data(const TdataType& data) {
- if (!data_needed) return;
- buffer = data;
- data_ready.notify_one();
- data_needed = false;
+ if (!d_data_needed)
+ return;
+ {
+ boost::mutex::scoped_lock lock(d_buffer_lock);
+ d_buffer = data;
+ d_data_needed = false;
+ }
+ d_data_ready.notify_one();
}
TdataType get() {
- boost::mutex::scoped_lock lock(buffer_lock);
- data_needed = true;
- data_ready.wait(lock);
- return buffer;
+ d_data_needed = true;
+ boost::mutex::scoped_lock lock(d_buffer_lock);
+ d_data_ready.wait(lock);
+ return d_buffer;
}
private:
- bool data_needed;
- boost::condition_variable data_ready;
- boost::mutex buffer_lock;
- TdataType buffer;
+ bool d_data_needed;
+ boost::condition_variable d_data_ready;
+ boost::mutex d_buffer_lock;
+ TdataType d_buffer;
};
#endif
- [Commit-gnuradio] [gnuradio] 42/50: controlport: QA needs to get host and port out of the endpoint., (continued)
- [Commit-gnuradio] [gnuradio] 42/50: controlport: QA needs to get host and port out of the endpoint., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 27/50: controlport: cleaning up; trying to handle shutdown better., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 19/50: controlport: simple style editing., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 36/50: controlport: renamed some functions for clairity, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 50/50: Merge branch 'ctrlport', git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 26/50: docs: adding in info on ControlPort and Thrift., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 49/50: cmake: fix case for ctrlport when no backends installed, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 12/50: controlport: reorg abstraction layers for RPC connections., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 46/50: controlport: avoid copy of outknobs (a temporary)., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 47/50: controlport: cleaner, more robust interface for buffer gets., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 48/50: controlport: better controlport probe mutex handling.,
git <=
- [Commit-gnuradio] [gnuradio] 44/50: docs: cleaning up some doxygen warnings and formatting., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 05/50: controlport: working gr-perf-monitorx application, git, 2015/04/16