summaryrefslogtreecommitdiff
path: root/gruel/src/lib
diff options
context:
space:
mode:
authorgit2009-08-15 02:49:48 +0000
committergit2009-08-15 02:49:48 +0000
commitca6bb9a194419707d421f19b15184116736276dd (patch)
tree83b1cbfcc13c0cdba638dcc203fcf466fd17d6b9 /gruel/src/lib
parent05e222427c2616282a3cda6d309ddbb887c6dc36 (diff)
downloadgnuradio-ca6bb9a194419707d421f19b15184116736276dd.tar.gz
gnuradio-ca6bb9a194419707d421f19b15184116736276dd.tar.bz2
gnuradio-ca6bb9a194419707d421f19b15184116736276dd.zip
Applied patch c1258.diff from Stephan Bruns (ticket:359)
This patch changes pmt_t to use boost intrusive pointers. Patch was modified to apply to new pmt location since the original patch was created, and add missing include file. Signed-off-by: Johnathan Corgan <jcorgan@corganenterprises.com> git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11595 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gruel/src/lib')
-rw-r--r--gruel/src/lib/pmt/pmt.cc2
-rw-r--r--gruel/src/lib/pmt/pmt_int.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/gruel/src/lib/pmt/pmt.cc b/gruel/src/lib/pmt/pmt.cc
index fbf557be1..fd4035f75 100644
--- a/gruel/src/lib/pmt/pmt.cc
+++ b/gruel/src/lib/pmt/pmt.cc
@@ -56,6 +56,8 @@ pmt_base::operator delete(void *p, size_t size)
#endif
+void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); }
+void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) delete p; }
pmt_base::~pmt_base()
{
diff --git a/gruel/src/lib/pmt/pmt_int.h b/gruel/src/lib/pmt/pmt_int.h
index 9aac322a7..ba865b418 100644
--- a/gruel/src/lib/pmt/pmt_int.h
+++ b/gruel/src/lib/pmt/pmt_int.h
@@ -24,6 +24,7 @@
#include <gruel/pmt.h>
#include <boost/utility.hpp>
+#include <boost/detail/atomic_count.hpp>
/*
* EVERYTHING IN THIS FILE IS PRIVATE TO THE IMPLEMENTATION!
@@ -35,8 +36,10 @@
namespace pmt {
class pmt_base : boost::noncopyable {
+ mutable boost::detail::atomic_count count_;
+
protected:
- pmt_base(){};
+ pmt_base() : count_(0) {};
virtual ~pmt_base();
public:
@@ -66,6 +69,9 @@ public:
virtual bool is_c32vector() const { return false; }
virtual bool is_c64vector() const { return false; }
+ friend void intrusive_ptr_add_ref(pmt_base* p);
+ friend void intrusive_ptr_release(pmt_base* p);
+
# if (PMT_LOCAL_ALLOCATOR)
void *operator new(size_t);
void operator delete(void *, size_t);