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

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 4a26939d7d61766875838518d9ac454c49319c34
Author: Alan M. Carroll <[email protected]>
AuthorDate: Wed May 25 10:39:17 2016 -0500

    TS-4486: Add release to MutexLock.
    
    (cherry picked from commit bcdcd63d81f46d80c40883b6e27e4a5532d188c4)
    
     Conflicts:
        iocore/eventsystem/I_Lock.h
---
 iocore/eventsystem/I_Lock.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/iocore/eventsystem/I_Lock.h b/iocore/eventsystem/I_Lock.h
index e90d1bf..e2a9999 100644
--- a/iocore/eventsystem/I_Lock.h
+++ b/iocore/eventsystem/I_Lock.h
@@ -432,6 +432,7 @@ class MutexLock
 {
 private:
   Ptr<ProxyMutex> m;
+  bool locked_p;
 
 public:
   MutexLock(
@@ -439,7 +440,7 @@ public:
     const SrcLoc &location, const char *ahandler,
 #endif // DEBUG
     ProxyMutex *am, EThread *t)
-    : m(am)
+    : m(am), locked_p(true)
   {
     Mutex_lock(
 #ifdef DEBUG
@@ -448,7 +449,15 @@ public:
       m, t);
   }
 
-  ~MutexLock() { Mutex_unlock(m, m->thread_holding); }
+  void
+  release()
+  {
+    if (locked_p)
+      Mutex_unlock(m, m->thread_holding);
+    locked_p = false;
+  }
+
+  ~MutexLock() { this->release(); }
 };
 
 /** Scoped try lock class for ProxyMutex

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to