trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [trafficserver] 05/33: TS-4425: Add Ptr::detach() to detach a RefCountObj from its holder.
Date Wed, 11 May 2016 20:31:29 GMT
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 <jpeach@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" <commits@trafficserver.apache.org>.

Mime
View raw message