summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/pmt/pmt.cc
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2017-01-05 20:51:35 +0100
committerSebastian Koslowski <koslowski@kit.edu>2017-01-05 20:51:35 +0100
commit10e7e270773a258b0356bafc3a5bbc4853f38a4c (patch)
tree5e55f5358a39e8caf453448ddc724ed66b61f387 /gnuradio-runtime/lib/pmt/pmt.cc
parent7f25c0120fc7bc6a6eeee87878cf387647d51614 (diff)
parent8d80d0adacc98b02392428ab5284d8417df9c776 (diff)
Merge remote-tracking branch 'upstream/next' into gtk3
Diffstat (limited to 'gnuradio-runtime/lib/pmt/pmt.cc')
-rw-r--r--gnuradio-runtime/lib/pmt/pmt.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/gnuradio-runtime/lib/pmt/pmt.cc b/gnuradio-runtime/lib/pmt/pmt.cc
index e09452e60e..da2a7e5cc2 100644
--- a/gnuradio-runtime/lib/pmt/pmt.cc
+++ b/gnuradio-runtime/lib/pmt/pmt.cc
@@ -63,9 +63,18 @@ 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; }
+void intrusive_ptr_add_ref(pmt_base* p)
+{
+ p->refcount_.fetch_add(1, boost::memory_order_relaxed);
+}
+void intrusive_ptr_release(pmt_base* p) {
+ if (p->refcount_.fetch_sub(1, boost::memory_order_release) == 1) {
+ boost::atomic_thread_fence(boost::memory_order_acquire);
+ delete p;
+ }
+}
+
pmt_base::~pmt_base()
{
// nop -- out of line virtual destructor