diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2003-06-08 13:29:22 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2003-06-08 13:29:22 +0000 |
commit | 0668c97690d5959f6d0d1a894904c778ec869b77 (patch) | |
tree | 62ddfa2afabfc087eec35ed257884afa14b2f8c3 /locks | |
parent | e171b9324b8f9ff93bb3ea53543f9face7dc5638 (diff) | |
download | libapr-0668c97690d5959f6d0d1a894904c778ec869b77.tar.gz |
POSIX says that passing a mutexattr object with default attributes to
pthread_mutex_init() is equivalent to passing NULL: simplify
apr_thread_mutex_create() to do the latter.
Fixes build on BSD/OS 4.0, which prototypes but does not implement
pthread_mutexattr_{init,destroy}, fooling the autoconf checks.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64532 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/unix/thread_mutex.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/locks/unix/thread_mutex.c b/locks/unix/thread_mutex.c index 07ff34cd3..ba0140821 100644 --- a/locks/unix/thread_mutex.c +++ b/locks/unix/thread_mutex.c @@ -77,7 +77,6 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, apr_pool_t *pool) { apr_thread_mutex_t *new_mutex; - pthread_mutexattr_t mattr; apr_status_t rv; new_mutex = (apr_thread_mutex_t *)apr_pcalloc(pool, @@ -94,23 +93,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, */ new_mutex->nested = flags & APR_THREAD_MUTEX_NESTED; - if ((rv = pthread_mutexattr_init(&mattr))) { -#ifdef PTHREAD_SETS_ERRNO - rv = errno; -#endif - thread_mutex_cleanup(new_mutex); - return rv; - } - - if ((rv = pthread_mutex_init(&new_mutex->mutex, &mattr))) { -#ifdef PTHREAD_SETS_ERRNO - rv = errno; -#endif - thread_mutex_cleanup(new_mutex); - return rv; - } - - if ((rv = pthread_mutexattr_destroy(&mattr))) { + if ((rv = pthread_mutex_init(&new_mutex->mutex, NULL))) { #ifdef PTHREAD_SETS_ERRNO rv = errno; #endif |