You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/05/11 20:31:29 UTC

[trafficserver] 05/33: TS-4425: Add Ptr::detach() to detach a RefCountObj from its holder.

This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 369ab4ce6eb974e12bbc8fdd8ae05115e7cadc59
Author: James Peach <jp...@apache.org>
AuthorDate: Sat May 7 09:12:09 2016 -0700

    TS-4425: Add Ptr::detach() to detach a RefCountObj from its holder.
---
 lib/ts/Ptr.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/ts/Ptr.h b/lib/ts/Ptr.h
index 56fc4cb..d1288fa 100644
--- a/lib/ts/Ptr.h
+++ b/lib/ts/Ptr.h
@@ -151,6 +151,16 @@ public:
     return static_cast<RefCountObj *>(m_ptr);
   }
 
+  // Return the stored pointer, storing NULL instead. Do not increment
+  // the refcount; the caller is now responsible for owning the RefCountObj.
+  T *
+  detach()
+  {
+    T *tmp = m_ptr;
+    m_ptr = NULL;
+    return tmp;
+  }
+
   T *m_ptr;
 };
 

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.