summaryrefslogtreecommitdiff
path: root/locks/win32
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2016-04-13 11:47:40 +0000
committerYann Ylavic <ylavic@apache.org>2016-04-13 11:47:40 +0000
commit391dd40f45fbcac7eef01698c5aacbb426e5dd17 (patch)
tree05faad2d501c8fb62b5691eb7d283e31f01e629c /locks/win32
parent2620df82b1b400caace45babcb0879cfe123d0f9 (diff)
downloadapr-391dd40f45fbcac7eef01698c5aacbb426e5dd17.tar.gz
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() function. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1738925 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks/win32')
-rw-r--r--locks/win32/proc_mutex.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/locks/win32/proc_mutex.c b/locks/win32/proc_mutex.c
index 83042ce35..9e227f762 100644
--- a/locks/win32/proc_mutex.c
+++ b/locks/win32/proc_mutex.c
@@ -265,6 +265,7 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
APR_DECLARE(apr_status_t) apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex,
apr_os_proc_mutex_t *ospmutex,
apr_lockmech_e mech,
+ int register_cleanup,
apr_pool_t *pool)
{
if (pool == NULL) {
@@ -273,12 +274,18 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex,
if (mech != APR_LOCK_DEFAULT && mech != APR_LOCK_DEFAULT_TIMED) {
return APR_ENOTIMPL;
}
+
if ((*pmutex) == NULL) {
(*pmutex) = (apr_proc_mutex_t *)apr_palloc(pool,
sizeof(apr_proc_mutex_t));
(*pmutex)->pool = pool;
}
(*pmutex)->handle = *ospmutex;
+
+ if (register_cleanup) {
+ apr_pool_cleanup_register(pool, *pmutex, proc_mutex_cleanup,
+ apr_pool_cleanup_null);
+ }
return APR_SUCCESS;
}
@@ -286,6 +293,7 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
apr_os_proc_mutex_t *ospmutex,
apr_pool_t *pool)
{
- return apr_os_proc_mutex_put_ex(pmutex, ospmutex, APR_LOCK_DEFAULT_TIMED, pool);
+ return apr_os_proc_mutex_put_ex(pmutex, ospmutex, APR_LOCK_DEFAULT_TIMED,
+ 0, pool);
}