[4.1] a4f4d44 dont panic on pthread_cond_timedwait being interrupted
Lasse Karstensen
lkarsten at varnish-software.com
Tue Jun 14 11:42:09 CEST 2016
commit a4f4d44235caf03e221a1b692b227ff06438aa21
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