apr_os_proc_mutex-unix: For consistency with other OS native to APR
types constructors/_put()ers and non-unix mutex mechanisms, always
destroy the underlying native mutex when apr_proc_mutex_destroy() is
called explicitly.


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1738926 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES b/CHANGES
index 46e1cdf..94b992f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 2.0.0
 
+  *) apr_os_proc_mutex-unix: For consistency with other OS native to APR
+     types constructors/_put()ers and non-unix mutex mechanisms, always
+     destroy the underlying native mutex when apr_proc_mutex_destroy() is
+     called explicitly.  [Yann Ylavic]
+
   *) apr_os_proc_mutex_put_ex: Allow to specify whether the OS native
      mutex should or not be cleaned up (destroyed) with the constructed
      APR mutex (given pool), and default to not for the simple _put()
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c
index 93df3ad..e29978a 100644
--- a/locks/unix/proc_mutex.c
+++ b/locks/unix/proc_mutex.c
@@ -23,7 +23,11 @@
 
 APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex)
 {
-    return apr_pool_cleanup_run(mutex->pool, mutex, apr_proc_mutex_cleanup);
+    apr_status_t rv = apr_proc_mutex_cleanup(mutex);
+    if (rv == APR_SUCCESS) {
+        apr_pool_cleanup_kill(mutex->pool, mutex, apr_proc_mutex_cleanup);
+    }
+    return rv;
 }
 
 #if APR_HAS_POSIXSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || \