diff options
author | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-20 21:11:43 +0000 |
---|---|---|
committer | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-20 21:11:43 +0000 |
commit | 633d9f59180a169cec108a0594df784239fbd235 (patch) | |
tree | e183f8f8a55061d4f99980add3f64b908c9b85e3 /locks | |
parent | 3c3dfa24af70f7831fdbf2ea1116ca5b2fecb3f2 (diff) | |
download | libapr-633d9f59180a169cec108a0594df784239fbd235.tar.gz |
Register the proc_mutex cleanup with an exported API. Most of this
change is just a name change to make it very obvious what is happening.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64050 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/unix/proc_mutex.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c index 24e1da7a9..cfbf62a45 100644 --- a/locks/unix/proc_mutex.c +++ b/locks/unix/proc_mutex.c @@ -63,6 +63,12 @@ #define SEM_FAILED (-1) #endif +static apr_status_t proc_mutex_destroy(apr_proc_mutex_t *mutex) +{ + return apr_pool_cleanup_run(mutex->pool, mutex, apr_proc_mutex_cleanup); +} + + static void proc_mutex_posix_setup(void) { } @@ -122,7 +128,7 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, sem_unlink((const char *) semname); new_mutex->interproc->filedes = (int)psem; /* Ugg */ apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, - proc_mutex_posix_cleanup, + apr_proc_mutex_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -149,17 +155,6 @@ static apr_status_t proc_mutex_posix_release(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static apr_status_t proc_mutex_posix_destroy(apr_proc_mutex_t *mutex) -{ - apr_status_t stat; - - if ((stat = proc_mutex_posix_cleanup(mutex)) == APR_SUCCESS) { - apr_pool_cleanup_kill(mutex->pool, mutex, proc_mutex_posix_cleanup); - return APR_SUCCESS; - } - return stat; -} - static apr_status_t proc_mutex_posix_child_init(apr_proc_mutex_t **mutex, apr_pool_t *cont, const char *fname) @@ -178,7 +173,7 @@ const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_posix_methods = proc_mutex_posix_acquire, NULL, /* no tryacquire */ proc_mutex_posix_release, - proc_mutex_posix_destroy, + proc_mutex_posix_cleanup, proc_mutex_posix_child_init, "posixsem" }; @@ -234,7 +229,7 @@ static apr_status_t proc_mutex_sysv_create(apr_proc_mutex_t *new_mutex, } new_mutex->curr_locked = 0; apr_pool_cleanup_register(new_mutex->pool, - (void *)new_mutex, proc_mutex_sysv_cleanup, + (void *)new_mutex, apr_proc_mutex_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -294,7 +289,7 @@ const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_sysv_methods = proc_mutex_sysv_acquire, NULL, /* no tryacquire */ proc_mutex_sysv_release, - proc_mutex_sysv_destroy, + proc_mutex_sysv_cleanup, proc_mutex_sysv_child_init, "sysvsem" }; @@ -399,7 +394,7 @@ static apr_status_t proc_mutex_proc_pthread_create(apr_proc_mutex_t *new_mutex, new_mutex->curr_locked = 0; apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, - proc_mutex_proc_pthread_cleanup, + apr_proc_mutex_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -469,7 +464,7 @@ const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_proc_pthread_method proc_mutex_proc_pthread_acquire, NULL, /* no tryacquire */ proc_mutex_proc_pthread_release, - proc_mutex_proc_pthread_destroy, + proc_mutex_proc_pthread_cleanup, proc_mutex_proc_pthread_child_init, "pthread" }; @@ -544,7 +539,7 @@ static apr_status_t proc_mutex_fcntl_create(apr_proc_mutex_t *new_mutex, unlink(new_mutex->fname); apr_pool_cleanup_register(new_mutex->pool, (void*)new_mutex, - proc_mutex_fcntl_cleanup, + apr_proc_mutex_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -605,7 +600,7 @@ const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_fcntl_methods = proc_mutex_fcntl_acquire, NULL, /* no tryacquire */ proc_mutex_fcntl_release, - proc_mutex_fcntl_destroy, + proc_mutex_fcntl_cleanup, proc_mutex_fcntl_child_init, "fcntl" }; @@ -659,7 +654,7 @@ static apr_status_t proc_mutex_flock_create(apr_proc_mutex_t *new_mutex, } new_mutex->curr_locked = 0; apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, - proc_mutex_flock_cleanup, + apr_proc_mutex_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -735,7 +730,7 @@ const apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_flock_methods = proc_mutex_flock_acquire, NULL, /* no tryacquire */ proc_mutex_flock_release, - proc_mutex_flock_destroy, + proc_mutex_flock_cleanup, proc_mutex_flock_child_init, "flock" }; @@ -895,9 +890,9 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) return mutex->meth->release(mutex); } -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) +APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex) { - return mutex->meth->destroy(mutex); + return ((apr_proc_mutex_t *)mutex)->meth->cleanup(mutex); } APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex) |