diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-05-31 20:56:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-05-31 20:56:05 +0000 |
commit | a6c43c64d9419dfa888b1c478e658e3e20a4af11 (patch) | |
tree | c44233797692f5a1878dfd1d614e5674a3c0e0a6 /locks/unix/thread_cond.c | |
parent | f7eb533f85d0941dbf6edb3081f065e4c010b8cc (diff) |
Notes
Diffstat (limited to 'locks/unix/thread_cond.c')
-rw-r--r-- | locks/unix/thread_cond.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/locks/unix/thread_cond.c b/locks/unix/thread_cond.c index db7dd4f0d973..3c8e3170a0dc 100644 --- a/locks/unix/thread_cond.c +++ b/locks/unix/thread_cond.c @@ -79,21 +79,31 @@ APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, apr_interval_time_t timeout) { apr_status_t rv; - apr_time_t then; - struct timespec abstime; + if (timeout < 0) { + rv = pthread_cond_wait(&cond->cond, &mutex->mutex); +#ifdef HAVE_ZOS_PTHREADS + if (rv) { + rv = errno; + } +#endif + } + else { + apr_time_t then; + struct timespec abstime; - then = apr_time_now() + timeout; - abstime.tv_sec = apr_time_sec(then); - abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */ + then = apr_time_now() + timeout; + abstime.tv_sec = apr_time_sec(then); + abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */ - rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime); + rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime); #ifdef HAVE_ZOS_PTHREADS - if (rv) { - rv = errno; - } + if (rv) { + rv = errno; + } #endif - if (ETIMEDOUT == rv) { - return APR_TIMEUP; + if (ETIMEDOUT == rv) { + return APR_TIMEUP; + } } return rv; } |