diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2003-10-04 11:46:24 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2003-10-04 11:46:24 +0000 |
commit | d42ddcd9a8ce73a329cab2d781724c117399c675 (patch) | |
tree | 9fd6d78ec0d7de1ccdf5088d93a3b0097475ec6b /locks | |
parent | 97668d1cada7056d5d345413c13a567602a6be1a (diff) | |
download | libapr-d42ddcd9a8ce73a329cab2d781724c117399c675.tar.gz |
* include/arch/unix/apr_arch_thread_rwlock.h: Store a pthread_rwlock_t
object in struct apr_thread_rwlock_t rather than a pointer to one.
* locks/unix/thread_rwlock.c (apr_thread_rwlock_create): Adjust use of
->rwlock, simplify to a single palloc call, and remove ENOMEM handling.
(apr_thread_rwlock_rdlock, apr_thread_rwlock_tryrdlock,
apr_thread_rwlock_wrlock, apr_thread_rwlock_trywrlock,
apr_thread_rwlock_unlock): Adjust use of ->rwlock appropriately.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/unix/thread_rwlock.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/locks/unix/thread_rwlock.c b/locks/unix/thread_rwlock.c index ad26e9488..55a45e0fd 100644 --- a/locks/unix/thread_rwlock.c +++ b/locks/unix/thread_rwlock.c @@ -66,7 +66,7 @@ static apr_status_t thread_rwlock_cleanup(void *data) apr_thread_rwlock_t *rwlock = (apr_thread_rwlock_t *)data; apr_status_t stat; - stat = pthread_rwlock_destroy(rwlock->rwlock); + stat = pthread_rwlock_destroy(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO if (stat) { stat = errno; @@ -81,22 +81,10 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, apr_thread_rwlock_t *new_rwlock; apr_status_t stat; - new_rwlock = (apr_thread_rwlock_t *)apr_pcalloc(pool, - sizeof(apr_thread_rwlock_t)); - - if (new_rwlock == NULL) { - return APR_ENOMEM; - } - + new_rwlock = apr_palloc(pool, sizeof(apr_thread_rwlock_t)); new_rwlock->pool = pool; - new_rwlock->rwlock = (pthread_rwlock_t *)apr_palloc(pool, - sizeof(pthread_rwlock_t)); - - if (new_rwlock->rwlock == NULL) { - return APR_ENOMEM; - } - if ((stat = pthread_rwlock_init(new_rwlock->rwlock, NULL))) { + if ((stat = pthread_rwlock_init(&new_rwlock->rwlock, NULL))) { #ifdef PTHREAD_SETS_ERRNO stat = errno; #endif @@ -115,7 +103,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) { apr_status_t stat; - stat = pthread_rwlock_rdlock(rwlock->rwlock); + stat = pthread_rwlock_rdlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO if (stat) { stat = errno; @@ -128,7 +116,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwloc { apr_status_t stat; - stat = pthread_rwlock_tryrdlock(rwlock->rwlock); + stat = pthread_rwlock_tryrdlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO if (stat) { stat = errno; @@ -144,7 +132,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) { apr_status_t stat; - stat = pthread_rwlock_wrlock(rwlock->rwlock); + stat = pthread_rwlock_wrlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO if (stat) { stat = errno; @@ -157,7 +145,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwloc { apr_status_t stat; - stat = pthread_rwlock_trywrlock(rwlock->rwlock); + stat = pthread_rwlock_trywrlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO if (stat) { stat = errno; @@ -173,7 +161,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) { apr_status_t stat; - stat = pthread_rwlock_unlock(rwlock->rwlock); + stat = pthread_rwlock_unlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO if (stat) { stat = errno; |