jorton 2003/06/08 06:29:22
Modified: locks/unix thread_mutex.c
Log:
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.
Revision Changes Path
1.16 +1 -18 apr/locks/unix/thread_mutex.c
Index: thread_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/unix/thread_mutex.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -u -r1.15 -r1.16
--- thread_mutex.c 6 Jan 2003 23:44:31 -0000 1.15
+++ thread_mutex.c 8 Jun 2003 13:29:22 -0000 1.16
@@ -77,7 +77,6 @@
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 @@
*/
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