[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 15/148: virtual destructor and shared ptr f
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 15/148: virtual destructor and shared ptr for transport |
Date: |
Mon, 15 Aug 2016 00:47:20 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.
commit 3061f3e9c7aa50ab20b90e4679217b9b658c0f4e
Author: Josh Blum <address@hidden>
Date: Tue Nov 3 22:59:53 2009 -0800
virtual destructor and shared ptr for transport
---
usrp2/host/lib/transport.cc | 3 ++-
usrp2/host/lib/transport.h | 3 ++-
usrp2/host/lib/usrp2.cc | 3 ++-
usrp2/host/lib/usrp2_impl.cc | 2 +-
usrp2/host/lib/usrp2_impl.h | 4 ++--
5 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/usrp2/host/lib/transport.cc b/usrp2/host/lib/transport.cc
index 325e829..4c180f9 100644
--- a/usrp2/host/lib/transport.cc
+++ b/usrp2/host/lib/transport.cc
@@ -22,6 +22,7 @@
#include "transport.h"
#include <stdexcept>
+#include <cstdio>
static void nop_cb(void *buff, size_t len){
//NOP
@@ -45,6 +46,7 @@ void usrp2::transport::start(){
if (d_running){
throw std::runtime_error("usrp2::transport for" + d_type_str + "
already started\n");
}
+ d_running = true;
d_thread = new boost::thread(boost::bind(&usrp2::transport::run, this));
}
@@ -58,7 +60,6 @@ void usrp2::transport::stop(){
void usrp2::transport::run(){
init();
- d_running = true;
void *buff;
while (d_running){
try{
diff --git a/usrp2/host/lib/transport.h b/usrp2/host/lib/transport.h
index c6a42f8..0b6198a 100644
--- a/usrp2/host/lib/transport.h
+++ b/usrp2/host/lib/transport.h
@@ -27,6 +27,7 @@ namespace usrp2 {
class transport {
public:
typedef boost::function<void(void*, size_t)> callback_t;
+ typedef boost::shared_ptr<transport> sptr;
private:
std::string d_type_str;
volatile bool d_running;
@@ -40,7 +41,7 @@ namespace usrp2 {
* \param type_str a descriptive string
*/
transport(const std::string &type_str);
- ~transport();
+ virtual ~transport();
/*!
* \brief Set the callback
* \param cb the callback created by boost::bind
diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc
index 0ed854a..b34e0b1 100644
--- a/usrp2/host/lib/usrp2.cc
+++ b/usrp2/host/lib/usrp2.cc
@@ -230,7 +230,8 @@ namespace usrp2 {
// Private constructor. Sole function is to create an impl.
usrp2::usrp2(const std::string &ifc, props *p, size_t rx_bufsize)
{
- d_impl = std::auto_ptr<impl>(new usrp2::impl(ifc, p, rx_bufsize, new
eth_ctrl_transport(ifc, p)));
+ transport::sptr ctrl_transport(new eth_ctrl_transport(ifc, p));
+ d_impl = std::auto_ptr<impl>(new usrp2::impl(ifc, p, rx_bufsize,
ctrl_transport));
}
// Public class destructor. d_impl will auto-delete.
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index e9bb4b8..ec9a24c 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -129,7 +129,7 @@ namespace usrp2 {
}
- usrp2::impl::impl(const std::string &ifc, props *p, size_t rx_bufsize,
transport *ctrl_transport)
+ usrp2::impl::impl(const std::string &ifc, props *p, size_t rx_bufsize,
transport::sptr ctrl_transport)
: d_eth_data(new eth_buffer(rx_bufsize)),
d_eth_ctrl(new ethernet()),
d_pf_data(0),
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index 50cb78a..8702705 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -132,10 +132,10 @@ namespace usrp2 {
void stop_data_thread();
void run_data_thread();
- transport *d_ctrl_transport;
+ transport::sptr d_ctrl_transport;
public:
- impl(const std::string &ifc, props *p, size_t rx_bufsize, transport
*ctrl_transport);
+ impl(const std::string &ifc, props *p, size_t rx_bufsize, transport::sptr
ctrl_transport);
~impl();
std::string mac_addr() const { return d_addr; } // FIXME: convert from
u2_mac_addr_t
- [Commit-gnuradio] [gnuradio] 04/148: Hosekeeping after control/data separation., (continued)
- [Commit-gnuradio] [gnuradio] 04/148: Hosekeeping after control/data separation., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 05/148: Removed references to U2_ETHERTYPE and CONTROL_CHAN. Moved non-txrx-related apps in firmware broken by this., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 06/148: Common naming convention for control and data thread stuff., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 02/148: working a separate ctrl ethernet device into the code, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 07/148: using boost threads for control and data, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 09/148: Refactored timeout handling, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 17/148: Began work on eth data transport class. Switched send in transport to use iovecs. Pass mac addr into eth transports rather than re-parsing., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 14/148: Created transport abstraction. Implemented ethernet transport for control. Control transport works in usrp impl. Needs a lot of cleanup., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 08/148: Removed omnithreads dependency from libusrp2, still debugging, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 18/148: Added a callback into the channel ring enqueue and dequeue. This will allow the deqeue caller to make an arbitrary call when its done with the data. Currently, the enqueue caller makes this callback a release_frames., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 15/148: virtual destructor and shared ptr for transport,
git <=
- [Commit-gnuradio] [gnuradio] 28/148: Cleaned up the parse ethernet stuff. Made an official max_buffs method for the transport., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 20/148: Created sbuff class to house chunks of memory, their length, and possible callback for freeing/cleanup. Switched ring and transport to make use of the sbuff on receive., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 37/148: Fixes usrp2 firmware configure with mb-gcc on ubuntu 9.10/autoconf 2.64. Disables the regression test for fopen since stdio is non-functional., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 22/148: usrp2 impl working with data transport. not up to full potential yet, but working. needs major cleanup., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 23/148: Changed the transport to return a vector of sbuffs. This way the ethernet can pass up as many buffs as ready., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 11/148: some house keeping while trying to fix thread exception, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 12/148: Disable interruption in those functions that use interruption points such as sleep, wait, and timed_wait., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 30/148: being more c++y with the ring, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 36/148: Merge branch 'vita_rx' of http://gnuradio.org/git/matt into wip/usrp2, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 29/148: cleanup stuff, git, 2016/08/14