Skip to content

Commit

Permalink
Remove the list of all mutexes, we have never used it for anything.
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdphk committed Dec 16, 2015
1 parent 26039a7 commit 1f490ae
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions bin/varnishd/cache/cache_lck.c
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
}
Expand All @@ -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);
Expand Down

0 comments on commit 1f490ae

Please sign in to comment.