aboutsummaryrefslogtreecommitdiffstats
path: root/locks/unix/thread_cond.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-05-31 20:56:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-05-31 20:56:05 +0000
commita6c43c64d9419dfa888b1c478e658e3e20a4af11 (patch)
treec44233797692f5a1878dfd1d614e5674a3c0e0a6 /locks/unix/thread_cond.c
parentf7eb533f85d0941dbf6edb3081f065e4c010b8cc (diff)
downloadsrc-vendor/apr.tar.gz
src-vendor/apr.zip
Vendor import apr-1.7.0vendor/apr/apr-1.7.0vendor/apr
Notes
Notes: svn path=/vendor/apr/dist/; revision=361666 svn path=/vendor/apr/apr-1.7.0/; revision=361667; tag=vendor/apr/apr-1.7.0
Diffstat (limited to 'locks/unix/thread_cond.c')
-rw-r--r--locks/unix/thread_cond.c32
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;
}