You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2021/07/05 08:12:51 UTC
svn commit: r1891269 - in /apr/apr/branches/1.7.x: ./
include/arch/unix/apr_arch_thread_mutex.h locks/unix/thread_mutex.c
Author: jorton
Date: Mon Jul 5 08:12:51 2021
New Revision: 1891269
URL: http://svn.apache.org/viewvc?rev=1891269&view=rev
Log:
Merge r1891204 from trunk:
* 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.
Modified:
apr/apr/branches/1.7.x/ (props changed)
apr/apr/branches/1.7.x/include/arch/unix/apr_arch_thread_mutex.h
apr/apr/branches/1.7.x/locks/unix/thread_mutex.c
Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
Merged /apr/apr/trunk:r1891204
Modified: apr/apr/branches/1.7.x/include/arch/unix/apr_arch_thread_mutex.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/include/arch/unix/apr_arch_thread_mutex.h?rev=1891269&r1=1891268&r2=1891269&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/include/arch/unix/apr_arch_thread_mutex.h (original)
+++ apr/apr/branches/1.7.x/include/arch/unix/apr_arch_thread_mutex.h Mon Jul 5 08:12:51 2021
@@ -33,8 +33,10 @@
struct apr_thread_mutex_t {
apr_pool_t *pool;
pthread_mutex_t mutex;
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
apr_thread_cond_t *cond;
int locked, num_waiters;
+#endif
};
#endif
Modified: apr/apr/branches/1.7.x/locks/unix/thread_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/locks/unix/thread_mutex.c?rev=1891269&r1=1891268&r2=1891269&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/locks/unix/thread_mutex.c (original)
+++ apr/apr/branches/1.7.x/locks/unix/thread_mutex.c Mon Jul 5 08:12:51 2021
@@ -102,6 +102,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
{
apr_status_t rv;
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
if (mutex->cond) {
apr_status_t rv2;
@@ -133,6 +134,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
return rv;
}
+#endif
rv = pthread_mutex_lock(&mutex->mutex);
#ifdef HAVE_ZOS_PTHREADS
@@ -148,6 +150,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
{
apr_status_t rv;
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
if (mutex->cond) {
apr_status_t rv2;
@@ -177,6 +180,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
return rv;
}
+#endif
rv = pthread_mutex_trylock(&mutex->mutex);
if (rv) {
@@ -281,6 +285,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
{
apr_status_t status;
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
if (mutex->cond) {
status = pthread_mutex_lock(&mutex->mutex);
if (status) {
@@ -303,6 +308,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
mutex->locked = 0;
}
+#endif
status = pthread_mutex_unlock(&mutex->mutex);
#ifdef HAVE_ZOS_PTHREADS
@@ -318,9 +324,12 @@ APR_DECLARE(apr_status_t) apr_thread_mut
{
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;