summaryrefslogtreecommitdiff
path: root/locks
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2017-04-05 16:24:00 +0000
committerYann Ylavic <ylavic@apache.org>2017-04-05 16:24:00 +0000
commit4ca6e8f64ecd5854fd68637a904473593f31ed1f (patch)
tree8d7aae8540a32b9dfdf98255b4db097d9c51a35a /locks
parent76fca5c1d81e7c0988b66e717790d6e2aa60d35b (diff)
downloadapr-4ca6e8f64ecd5854fd68637a904473593f31ed1f.tar.gz
Follow up to r1667900: semtimedop() should be passed a relative timeout rather
then absolute. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790296 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r--locks/unix/proc_mutex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c
index 9ef996204..1ae4be8a5 100644
--- a/locks/unix/proc_mutex.c
+++ b/locks/unix/proc_mutex.c
@@ -343,8 +343,11 @@ static apr_status_t proc_mutex_sysv_timedacquire(apr_proc_mutex_t *mutex,
else {
int rc;
struct timespec abstime;
- if (!absolute) {
- timeout += apr_time_now();
+ if (absolute) {
+ timeout -= apr_time_now();
+ if (timeout < 0) {
+ return proc_mutex_sysv_tryacquire(mutex);
+ }
}
abstime.tv_sec = apr_time_sec(timeout);
abstime.tv_nsec = apr_time_usec(timeout) * 1000; /* nanoseconds */