[4.1] c9debc7 Remove the list of all mutexes, we have never used it for anything.

Lasse Karstensen lkarsten at varnish-software.com
Thu Jan 14 15:15:09 CET 2016


commit c9debc783016d35d16006fc039ce9fb43fe157e1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Dec 16 22:36:51 2015 +0000

    Remove the list of all mutexes, we have never used it for anything.

diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index c623ab7..f1cea24 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -41,25 +41,18 @@
 
 #include "cache.h"
 
-/*The constability of lck depends on platform pthreads implementation */
-
 struct ilck {
 	unsigned		magic;
 #define ILCK_MAGIC		0x7b86c8a5
-	pthread_mutex_t		mtx;
 	int			held;
+	pthread_mutex_t		mtx;
 	pthread_t		owner;
-	VTAILQ_ENTRY(ilck)	list;
 	const char		*w;
 	struct VSC_C_lck	*stat;
 };
 
 static pthread_mutexattr_t attr;
 
-static VTAILQ_HEAD(, ilck)	ilck_head = VTAILQ_HEAD_INITIALIZER(ilck_head);
-
-static pthread_mutex_t		lck_mtx;
-
 /*--------------------------------------------------------------------*/
 
 static void
@@ -226,9 +219,6 @@ Lck__New(struct lock *lck, struct VSC_C_lck *st, const char *w)
 	ilck->stat = st;
 	ilck->stat->creat++;
 	AZ(pthread_mutex_init(&ilck->mtx, &attr));
-	AZ(pthread_mutex_lock(&lck_mtx));
-	VTAILQ_INSERT_TAIL(&ilck_head, ilck, list);
-	AZ(pthread_mutex_unlock(&lck_mtx));
 	lck->priv = ilck;
 }
 
@@ -240,9 +230,6 @@ Lck_Delete(struct lock *lck)
 	CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC);
 	ilck->stat->destroy++;
 	lck->priv = NULL;
-	AZ(pthread_mutex_lock(&lck_mtx));
-	VTAILQ_REMOVE(&ilck_head, ilck, list);
-	AZ(pthread_mutex_unlock(&lck_mtx));
 	AZ(pthread_mutex_destroy(&ilck->mtx));
 	FREE_OBJ(ilck);
 }
@@ -259,7 +246,6 @@ LCK_Init(void)
 #if !defined(__APPLE__) && !defined(__MACH__)
 	AZ(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK));
 #endif
-	AZ(pthread_mutex_init(&lck_mtx, &attr));
 #define LOCK(nam)						\
 	lck_##nam = VSM_Alloc(sizeof(struct VSC_C_lck),		\
 	   VSC_CLASS, VSC_type_lck, #nam);



More information about the varnish-commit mailing list