summaryrefslogtreecommitdiff
path: root/locks/netware
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2017-04-07 00:01:16 +0000
committerYann Ylavic <ylavic@apache.org>2017-04-07 00:01:16 +0000
commitf7b5a5f20e3edfb8ef2f4077147acb0bf17b3fab (patch)
tree5c5c8a818d677acc7cf00a9b3cd5bfbf9a669977 /locks/netware
parent0ea4c151aa5f650867a0afa3e92f90fc1bdbf114 (diff)
downloadapr-f7b5a5f20e3edfb8ef2f4077147acb0bf17b3fab.tar.gz
locks: follow up to r1667900.
Axe the 'absolute' argument of apr_{thread,proc,global}_mutex_timedlock() which was confusing, hence 'timeout' is always relative now. It still makes sense (to me) to handle a negative timeout as INFINITE, a nul one as IMMEDIATE, and a positive one as an upper bound timeout (like most if not all of the underlying system calls...). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790488 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks/netware')
-rw-r--r--locks/netware/proc_mutex.c5
-rw-r--r--locks/netware/thread_mutex.c26
2 files changed, 13 insertions, 18 deletions
diff --git a/locks/netware/proc_mutex.c b/locks/netware/proc_mutex.c
index 231f242b4..01cd7cfec 100644
--- a/locks/netware/proc_mutex.c
+++ b/locks/netware/proc_mutex.c
@@ -73,11 +73,10 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
}
APR_DECLARE(apr_status_t) apr_proc_mutex_timedlock(apr_proc_mutex_t *mutex,
- apr_time_t timeout,
- int absolute)
+ apr_time_t timeout)
{
if (mutex)
- return apr_thread_mutex_timedlock(mutex->mutex, timeout, absolute);
+ return apr_thread_mutex_timedlock(mutex->mutex, timeout);
return APR_ENOLOCK;
}
diff --git a/locks/netware/thread_mutex.c b/locks/netware/thread_mutex.c
index c634edfac..ecb0112f4 100644
--- a/locks/netware/thread_mutex.c
+++ b/locks/netware/thread_mutex.c
@@ -112,30 +112,26 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex)
}
APR_DECLARE(apr_status_t) apr_thread_mutex_timedlock(apr_thread_mutex_t *mutex,
- apr_time_t timeout,
- int absolute)
+ apr_time_t timeout)
{
if (mutex->cond) {
apr_status_t rv;
NXLock(mutex->mutex);
if (mutex->locked) {
- mutex->num_waiters++;
- if (timeout < 0) {
- rv = apr_thread_cond_wait(mutex->cond, mutex);
+ if (!timeout) {
+ rv = APR_TIMEUP;
}
else {
- if (absolute) {
- apr_time_t now = apr_time_now();
- if (timeout > now) {
- timeout -= now;
- }
- else {
- timeout = 0;
- }
+ mutex->num_waiters++;
+ if (timeout < 0) {
+ rv = apr_thread_cond_wait(mutex->cond, mutex);
+ }
+ else {
+ rv = apr_thread_cond_timedwait(mutex->cond, mutex,
+ timeout);
}
- rv = apr_thread_cond_timedwait(mutex->cond, mutex, timeout);
+ mutex->num_waiters--;
}
- mutex->num_waiters--;
}
else {
mutex->locked = 1;