summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-05-14 17:11:05 -0700
committerJosh Blum <josh@joshknows.com>2011-05-14 20:28:20 -0700
commitea5ce50a465e714c63196f52df97fb3e927e701c (patch)
treed69b081995d483ebb43d0971e48e401cd35c1a53 /host/lib/usrp/usrp1
parent4b772ff4f3b1e388e150402beaf6567f3ea29e1c (diff)
downloaduhd-ea5ce50a465e714c63196f52df97fb3e927e701c.tar.gz
uhd-ea5ce50a465e714c63196f52df97fb3e927e701c.tar.bz2
uhd-ea5ce50a465e714c63196f52df97fb3e927e701c.zip
uhd: replace managed buffer shared pointer w/ intrusive pointer to reduce overhead
Diffstat (limited to 'host/lib/usrp/usrp1')
-rw-r--r--host/lib/usrp/usrp1/io_impl.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp
index 7252ac587..8ac2696eb 100644
--- a/host/lib/usrp/usrp1/io_impl.cpp
+++ b/host/lib/usrp/usrp1/io_impl.cpp
@@ -61,39 +61,28 @@ class offset_managed_send_buffer : public managed_send_buffer{
public:
typedef boost::function<void(offset_send_buffer&, offset_send_buffer&, size_t)> commit_cb_type;
offset_managed_send_buffer(const commit_cb_type &commit_cb):
- _expired(true), _commit_cb(commit_cb)
+ _commit_cb(commit_cb)
{
/* NOP */
}
- bool expired(void){return _expired;}
-
void commit(size_t size){
- if (_expired) return;
- this->_commit_cb(_curr_buff, _next_buff, size);
- _expired = true;
+ if (size != 0) this->_commit_cb(_curr_buff, _next_buff, size);
}
sptr get_new(
offset_send_buffer &curr_buff,
offset_send_buffer &next_buff
){
- _expired = false;
_curr_buff = curr_buff;
_next_buff = next_buff;
- return sptr(this, &offset_managed_send_buffer::fake_deleter);
+ return make_managed_buffer(this);
}
private:
- static void fake_deleter(void *){
- //dont do anything and assume the bastard committed it
- //static_cast<offset_managed_send_buffer *>(obj)->commit(0);
- }
-
void *get_buff(void) const{return _curr_buff.buff->cast<char *>() + _curr_buff.offset;}
size_t get_size(void) const{return _curr_buff.buff->size() - _curr_buff.offset;}
- bool _expired;
offset_send_buffer _curr_buff, _next_buff;
commit_cb_type _commit_cb;
};
@@ -210,7 +199,7 @@ void usrp1_impl::io_impl::flush_send_buff(void){
bool usrp1_impl::io_impl::get_send_buffs(
vrt_packet_handler::managed_send_buffs_t &buffs
){
- UHD_ASSERT_THROW(omsb.expired() and buffs.size() == 1);
+ UHD_ASSERT_THROW(buffs.size() == 1);
//try to get a new managed buffer with timeout
offset_send_buffer next_buff(data_transport->get_send_buff(send_timeout));