[master] 0895d2e dont panic on pthread_cond_timedwait being interrupted
Nils Goroll
nils.goroll at uplex.de
Mon May 9 10:23:05 CEST 2016
commit 0895d2e61f61c2942e6bc4db3347adec7966d6c2
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon May 9 10:18:32 2016 +0200
dont panic on pthread_cond_timedwait being interrupted
As discussed with phk: Callers of Lck_CondWait with timeout should
be prepared for early wakeups.
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index b702c2f..90190dc 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -198,7 +198,9 @@ Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double when)
ts.tv_nsec = (long)(modf(when, &t) * 1e9);
ts.tv_sec = (long)t;
retval = pthread_cond_timedwait(cond, &ilck->mtx, &ts);
- assert(retval == 0 || retval == ETIMEDOUT);
+ assert(retval == 0 ||
+ retval == ETIMEDOUT ||
+ retval == EINTR);
}
AZ(ilck->held);
ilck->held = 1;
More information about the varnish-commit
mailing list