[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11595 - in gnuradio/trunk/gruel/src: include/gruel li
From: |
git |
Subject: |
[Commit-gnuradio] r11595 - in gnuradio/trunk/gruel/src: include/gruel lib/pmt |
Date: |
Fri, 14 Aug 2009 20:49:48 -0600 (MDT) |
Author: git
Date: 2009-08-14 20:49:48 -0600 (Fri, 14 Aug 2009)
New Revision: 11595
Modified:
gnuradio/trunk/gruel/src/include/gruel/pmt.h
gnuradio/trunk/gruel/src/lib/pmt/pmt.cc
gnuradio/trunk/gruel/src/lib/pmt/pmt_int.h
Log:
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 <address@hidden>
Modified: gnuradio/trunk/gruel/src/include/gruel/pmt.h
===================================================================
--- gnuradio/trunk/gruel/src/include/gruel/pmt.h 2009-08-15 02:49:47 UTC
(rev 11594)
+++ gnuradio/trunk/gruel/src/include/gruel/pmt.h 2009-08-15 02:49:48 UTC
(rev 11595)
@@ -23,7 +23,7 @@
#ifndef INCLUDED_PMT_H
#define INCLUDED_PMT_H
-#include <boost/shared_ptr.hpp>
+#include <boost/intrusive_ptr.hpp>
#include <boost/any.hpp>
#include <complex>
#include <string>
@@ -50,8 +50,10 @@
* \brief typedef for shared pointer (transparent reference counting).
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*/
-typedef boost::shared_ptr<pmt_base> pmt_t;
+typedef boost::intrusive_ptr<pmt_base> pmt_t;
+extern void intrusive_ptr_add_ref(pmt_base*);
+extern void intrusive_ptr_release(pmt_base*);
class pmt_exception : public std::logic_error
{
Modified: gnuradio/trunk/gruel/src/lib/pmt/pmt.cc
===================================================================
--- gnuradio/trunk/gruel/src/lib/pmt/pmt.cc 2009-08-15 02:49:47 UTC (rev
11594)
+++ gnuradio/trunk/gruel/src/lib/pmt/pmt.cc 2009-08-15 02:49:48 UTC (rev
11595)
@@ -56,6 +56,8 @@
#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()
{
Modified: gnuradio/trunk/gruel/src/lib/pmt/pmt_int.h
===================================================================
--- gnuradio/trunk/gruel/src/lib/pmt/pmt_int.h 2009-08-15 02:49:47 UTC (rev
11594)
+++ gnuradio/trunk/gruel/src/lib/pmt/pmt_int.h 2009-08-15 02:49:48 UTC (rev
11595)
@@ -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 @@
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11595 - in gnuradio/trunk/gruel/src: include/gruel lib/pmt,
git <=