diff options
author | Josh Blum <josh@joshknows.com> | 2011-05-14 17:11:05 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-05-14 20:28:20 -0700 |
commit | ea5ce50a465e714c63196f52df97fb3e927e701c (patch) | |
tree | d69b081995d483ebb43d0971e48e401cd35c1a53 /host/lib/transport | |
parent | 4b772ff4f3b1e388e150402beaf6567f3ea29e1c (diff) | |
download | uhd-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/transport')
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 12 | ||||
-rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 12 |
2 files changed, 4 insertions, 20 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index d4cfab422..28bea978b 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -73,14 +73,10 @@ public: sptr get_new(void){ _expired = false; - return sptr(this, &libusb_zero_copy_mrb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<libusb_zero_copy_mrb *>(obj)->release(); - } - const void *get_buff(void) const{return _lut->buffer;} size_t get_size(void) const{return _lut->actual_length;} @@ -108,14 +104,10 @@ public: sptr get_new(void){ _expired = false; - return sptr(this, &libusb_zero_copy_msb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<libusb_zero_copy_msb *>(obj)->commit(0); - } - void *get_buff(void) const{return _lut->buffer;} size_t get_size(void) const{return _lut->length;} diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index c3ba085bf..8c97e1e99 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -52,16 +52,12 @@ public: sptr get_new(size_t len){ _len = len; - return sptr(this, &udp_zero_copy_asio_mrb::fake_deleter); + return make_managed_buffer(this); } template <class T> T cast(void) const{return static_cast<T>(_mem);} private: - static void fake_deleter(void *obj){ - static_cast<udp_zero_copy_asio_mrb *>(obj)->release(); - } - const void *get_buff(void) const{return _mem;} size_t get_size(void) const{return _len;} @@ -90,14 +86,10 @@ public: sptr get_new(size_t len){ _len = len; - return sptr(this, &udp_zero_copy_asio_msb::fake_deleter); + return make_managed_buffer(this); } private: - static void fake_deleter(void *obj){ - static_cast<udp_zero_copy_asio_msb *>(obj)->commit(0); - } - void *get_buff(void) const{return _mem;} size_t get_size(void) const{return _len;} |