diff options
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/usrp1/io_impl.cpp | 19 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/usrp_e100_mmap_zero_copy.cpp | 12 |
2 files changed, 6 insertions, 25 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)); 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 26774aeda..bb421507a 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 @@ -51,14 +51,10 @@ public: sptr get_new(void){ if (fp_verbose) UHD_LOGV(always) << " make_recv_buff: " << get_size() << std::endl; _info->flags = RB_USER_PROCESS; //claim the frame - return sptr(this, &usrp_e100_mmap_zero_copy_mrb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<usrp_e100_mmap_zero_copy_mrb *>(obj)->release(); - } - const void *get_buff(void) const{return _mem;} size_t get_size(void) const{return _info->len;} @@ -90,14 +86,10 @@ public: sptr get_new(void){ if (fp_verbose) UHD_LOGV(always) << " make_send_buff: " << get_size() << std::endl; _info->flags = RB_USER_PROCESS; //claim the frame - return sptr(this, &usrp_e100_mmap_zero_copy_msb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<usrp_e100_mmap_zero_copy_msb *>(obj)->commit(0); - } - void *get_buff(void) const{return _mem;} size_t get_size(void) const{return _len;} |