diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2000-07-31 15:39:01 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2000-07-31 15:39:01 +0000 |
commit | ff8bec7811195a93483ddbb938ac4a2696b1fc78 (patch) | |
tree | 632bec1d7f2f2742888b5b3ac4b54eff91eb9abd /locks | |
parent | 1669f4bfd99ed8f4913a591cfff76eb508bb4e6a (diff) | |
download | libapr-ff8bec7811195a93483ddbb938ac4a2696b1fc78.tar.gz |
Fix some problems with which error code to use after a pthread_ failure.
Most of the changes added support for PTHREAD_SETS_ERRNO; a few of the
changes fixed bugs in existing code which always used errno (which
doesn't get the right error code on most platforms).
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60460 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/unix/intraproc.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/locks/unix/intraproc.c b/locks/unix/intraproc.c index 68ab1a88c..e598e56e3 100644 --- a/locks/unix/intraproc.c +++ b/locks/unix/intraproc.c @@ -61,7 +61,15 @@ static ap_status_t lock_intra_cleanup(void *data) { ap_lock_t *lock = (ap_lock_t *) data; - return pthread_mutex_unlock(lock->intraproc); + ap_status_t stat; + + stat = pthread_mutex_unlock(lock->intraproc); +#ifdef PTHREAD_SETS_ERRNO + if (stat) { + stat = errno; + } +#endif + return stat; } ap_status_t ap_unix_create_intra_lock(ap_lock_t *new) @@ -75,16 +83,25 @@ ap_status_t ap_unix_create_intra_lock(ap_lock_t *new) return errno; } if ((stat = pthread_mutexattr_init(&mattr))) { +#ifdef PTHREAD_SETS_ERRNO + stat = errno; +#endif lock_intra_cleanup(new); return stat; } if ((stat = pthread_mutex_init(new->intraproc, &mattr))) { +#ifdef PTHREAD_SETS_ERRNO + stat = errno; +#endif lock_intra_cleanup(new); return stat; } if ((stat = pthread_mutexattr_destroy(&mattr))) { +#ifdef PTHREAD_SETS_ERRNO + stat = errno; +#endif lock_intra_cleanup(new); return stat; } @@ -97,7 +114,15 @@ ap_status_t ap_unix_create_intra_lock(ap_lock_t *new) ap_status_t ap_unix_lock_intra(ap_lock_t *lock) { - return pthread_mutex_lock(lock->intraproc); + ap_status_t stat; + + stat = pthread_mutex_lock(lock->intraproc); +#ifdef PTHREAD_SETS_ERRNO + if (stat) { + stat = errno; + } +#endif + return stat; } ap_status_t ap_unix_unlock_intra(ap_lock_t *lock) @@ -105,6 +130,11 @@ ap_status_t ap_unix_unlock_intra(ap_lock_t *lock) ap_status_t status; status = pthread_mutex_unlock(lock->intraproc); +#ifdef PTHREAD_SETS_ERRNO + if (status) { + status = errno; + } +#endif return status; } |