[experimental-ims] 9e0f29c Attempt to close a theoretical race, which POSIX_MISTAKE makes it impossible to deal with correctly.
geoff at varnish-cache.org
Tue Jan 10 00:03:33 CET 2012
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Dec 27 14:55:59 2011 +0000
Attempt to close a theoretical race, which POSIX_MISTAKE makes it
impossible to deal with correctly.
Pointed out by: Dong Feng
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index cff9845..2910582 100644
@@ -98,6 +98,17 @@ Lck__Unlock(struct lock *lck, const char *p, const char *f, int l)
ilck->held = 0;
+ * #ifdef POSIX_STUPIDITY:
+ * The pthread_t type has no defined assignment or comparison
+ * operators, this is why pthread_equal() is necessary.
+ * Unfortunately POSIX forgot to define a NULL value for pthread_t
+ * so you can never unset a pthread_t variable.
+ * We hack it and fill it with zero bits, hoping for sane
+ * implementations of pthread.
+ * #endif
+ memset(&ilck->owner, 0, sizeof ilck->owner);
if (cache_param->diag_bitmap & 0x8)
VSL(SLT_Debug, 0, "MTX_UNLOCK(%s,%s,%d,%s)", p, f, l, ilck->w);
More information about the varnish-commit