diff options
author | Joe Orton <jorton@apache.org> | 2021-07-02 14:37:54 +0000 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2021-07-02 14:37:54 +0000 |
commit | 58166301ec55aec46c9e9ae1a44285c124445de6 (patch) | |
tree | 5c6103c92ad2e074ed60639cff7acf0a35b14f73 /locks | |
parent | 96c00891deae358156db4af48d14451ddbe646eb (diff) | |
download | apr-58166301ec55aec46c9e9ae1a44285c124445de6.tar.gz |
* locks/unix/thread_mutex.c,
include/arch/unix/apr_arch_thread_mutex.h: Completely drop the code
required imitate the mutex via a condition variable if
HAVE_PTHREAD_MUTEX_TIMEDLOCK is defined.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891204 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/unix/thread_mutex.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/locks/unix/thread_mutex.c b/locks/unix/thread_mutex.c index 5e21aac13..9cd643bec 100644 --- a/locks/unix/thread_mutex.c +++ b/locks/unix/thread_mutex.c @@ -121,6 +121,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) { apr_status_t rv; +#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK if (mutex->cond) { apr_status_t rv2; @@ -152,6 +153,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) return rv; } +#endif rv = pthread_mutex_lock(&mutex->mutex); #ifdef HAVE_ZOS_PTHREADS @@ -167,6 +169,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) { apr_status_t rv; +#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK if (mutex->cond) { apr_status_t rv2; @@ -196,6 +199,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) return rv; } +#endif rv = pthread_mutex_trylock(&mutex->mutex); if (rv) { @@ -298,6 +302,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) { apr_status_t status; +#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK if (mutex->cond) { status = pthread_mutex_lock(&mutex->mutex); if (status) { @@ -320,6 +325,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) mutex->locked = 0; } +#endif status = pthread_mutex_unlock(&mutex->mutex); #ifdef HAVE_ZOS_PTHREADS @@ -335,9 +341,12 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) { apr_status_t rv, rv2 = APR_SUCCESS; +#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK if (mutex->cond) { rv2 = apr_thread_cond_destroy(mutex->cond); } +#endif + rv = apr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup); if (rv == APR_SUCCESS) { rv = rv2; |