aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-05 12:44:23 -0800
committerJosh Blum <josh@joshknows.com>2011-02-05 12:44:23 -0800
commitba2523fca4ee9bb0336a3fd8e7e7571c344e37f3 (patch)
treed3d24b5f89f0a8c118cb83be9b9046b2ca81c6b0 /host
parent5d10aa397f044ea6781b4977c14171abfb4a727d (diff)
downloaduhd-ba2523fca4ee9bb0336a3fd8e7e7571c344e37f3.tar.gz
uhd-ba2523fca4ee9bb0336a3fd8e7e7571c344e37f3.tar.bz2
uhd-ba2523fca4ee9bb0336a3fd8e7e7571c344e37f3.zip
uhd: removed instances of shared_from_this() in transports
Its known to be slow and using sptrs of large objects. This should be a slight performance improvement for libusb and usrp_e100_mmap implementation.
Diffstat (limited to 'host')
-rwxr-xr-x[-rw-r--r--]host/lib/transport/gen_vrt_if_packet.py0
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp7
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_mmap_zero_copy.cpp9
3 files changed, 7 insertions, 9 deletions
diff --git a/host/lib/transport/gen_vrt_if_packet.py b/host/lib/transport/gen_vrt_if_packet.py
index 3ba562d68..3ba562d68 100644..100755
--- a/host/lib/transport/gen_vrt_if_packet.py
+++ b/host/lib/transport/gen_vrt_if_packet.py
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index d4c82617c..5ae6db39e 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -23,7 +23,6 @@
#include <uhd/utils/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <vector>
#include <iostream>
@@ -279,7 +278,7 @@ libusb_transfer *usb_endpoint::get_lut_with_wait(double timeout){
/***********************************************************************
* USB zero_copy device class
**********************************************************************/
-class libusb_zero_copy_impl : public usb_zero_copy, public boost::enable_shared_from_this<libusb_zero_copy_impl> {
+class libusb_zero_copy_impl : public usb_zero_copy{
public:
libusb_zero_copy_impl(
@@ -400,7 +399,7 @@ managed_recv_buffer::sptr libusb_zero_copy_impl::get_recv_buff(double timeout){
else {
return managed_recv_buffer::make_safe(
boost::asio::const_buffer(lut->buffer, lut->actual_length),
- boost::bind(&libusb_zero_copy_impl::release, shared_from_this(), lut)
+ boost::bind(&libusb_zero_copy_impl::release, this, lut)
);
}
}
@@ -420,7 +419,7 @@ managed_send_buffer::sptr libusb_zero_copy_impl::get_send_buff(double timeout){
else {
return managed_send_buffer::make_safe(
boost::asio::mutable_buffer(lut->buffer, this->get_send_frame_size()),
- boost::bind(&libusb_zero_copy_impl::commit, shared_from_this(), lut, _1)
+ boost::bind(&libusb_zero_copy_impl::commit, this, lut, _1)
);
}
}
diff --git a/host/lib/usrp/usrp_e100/usrp_e100_mmap_zero_copy.cpp b/host/lib/usrp/usrp_e100/usrp_e100_mmap_zero_copy.cpp
index bf378a9b1..c07e6e011 100644
--- a/host/lib/usrp/usrp_e100/usrp_e100_mmap_zero_copy.cpp
+++ b/host/lib/usrp/usrp_e100/usrp_e100_mmap_zero_copy.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@
#include <unistd.h> //getpagesize
#include <poll.h> //poll
#include <boost/bind.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <iostream>
using namespace uhd;
@@ -36,7 +35,7 @@ static const size_t poll_breakout = 10; //how many poll timeouts constitute a fu
/***********************************************************************
* The zero copy interface implementation
**********************************************************************/
-class usrp_e100_mmap_zero_copy_impl : public zero_copy_if, public boost::enable_shared_from_this<usrp_e100_mmap_zero_copy_impl> {
+class usrp_e100_mmap_zero_copy_impl : public zero_copy_if{
public:
usrp_e100_mmap_zero_copy_impl(usrp_e100_iface::sptr iface):
_fd(iface->get_file_descriptor()), _recv_index(0), _send_index(0)
@@ -126,7 +125,7 @@ public:
if (fp_verbose) std::cout << " make_recv_buff: " << info->len << std::endl;
return managed_recv_buffer::make_safe(
boost::asio::const_buffer(mem, info->len),
- boost::bind(&usrp_e100_mmap_zero_copy_impl::release, shared_from_this(), info)
+ boost::bind(&usrp_e100_mmap_zero_copy_impl::release, this, info)
);
}
@@ -162,7 +161,7 @@ public:
if (fp_verbose) std::cout << " make_send_buff: " << _frame_size << std::endl;
return managed_send_buffer::make_safe(
boost::asio::mutable_buffer(mem, _frame_size),
- boost::bind(&usrp_e100_mmap_zero_copy_impl::commit, shared_from_this(), info, _1)
+ boost::bind(&usrp_e100_mmap_zero_copy_impl::commit, this, info, _1)
);
}