Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
d549b55f
Commit
d549b55f
authored
Dec 16, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible to creat LCK classes at runtime.
Use the hash_classic class as proof of concept
parent
1f490ae7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
cache.h
bin/varnishd/cache/cache.h
+2
-0
cache_lck.c
bin/varnishd/cache/cache_lck.c
+9
-3
hash_classic.c
bin/varnishd/hash/hash_classic.c
+3
-0
locks.h
include/tbl/locks.h
+0
-1
No files found.
bin/varnishd/cache/cache.h
View file @
d549b55f
...
...
@@ -827,6 +827,8 @@ int Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double);
#define Lck_Trylock(a) Lck__Trylock(a, __func__, __LINE__)
#define Lck_AssertHeld(a) Lck__Assert(a, 1)
struct
VSC_C_lck
*
Lck_CreateClass
(
const
char
*
name
);
#define LOCK(nam) extern struct VSC_C_lck *lck_##nam;
#include "tbl/locks.h"
#undef LOCK
...
...
bin/varnishd/cache/cache_lck.c
View file @
d549b55f
...
...
@@ -212,6 +212,7 @@ Lck__New(struct lock *lck, struct VSC_C_lck *st, const char *w)
struct
ilck
*
ilck
;
AN
(
st
);
AN
(
w
);
AZ
(
lck
->
priv
);
ALLOC_OBJ
(
ilck
,
ILCK_MAGIC
);
AN
(
ilck
);
...
...
@@ -234,6 +235,13 @@ Lck_Delete(struct lock *lck)
FREE_OBJ
(
ilck
);
}
struct
VSC_C_lck
*
Lck_CreateClass
(
const
char
*
name
)
{
return
(
VSM_Alloc
(
sizeof
(
struct
VSC_C_lck
),
VSC_CLASS
,
VSC_type_lck
,
name
));
}
#define LOCK(nam) struct VSC_C_lck *lck_##nam;
#include "tbl/locks.h"
#undef LOCK
...
...
@@ -246,9 +254,7 @@ LCK_Init(void)
#if !defined(__APPLE__) && !defined(__MACH__)
AZ
(
pthread_mutexattr_settype
(
&
attr
,
PTHREAD_MUTEX_ERRORCHECK
));
#endif
#define LOCK(nam) \
lck_##nam = VSM_Alloc(sizeof(struct VSC_C_lck), \
VSC_CLASS, VSC_type_lck, #nam);
#define LOCK(nam) lck_##nam = Lck_CreateClass(#nam);
#include "tbl/locks.h"
#undef LOCK
}
bin/varnishd/hash/hash_classic.c
View file @
d549b55f
...
...
@@ -38,6 +38,8 @@
#include "hash/hash_slinger.h"
static
struct
VSC_C_lck
*
lck_hcl
;
/*--------------------------------------------------------------------*/
struct
hcl_hd
{
...
...
@@ -90,6 +92,7 @@ hcl_start(void)
{
unsigned
u
;
lck_hcl
=
Lck_CreateClass
(
"hcl"
);
hcl_head
=
calloc
(
sizeof
*
hcl_head
,
hcl_nhash
);
XXXAN
(
hcl_head
);
...
...
include/tbl/locks.h
View file @
d549b55f
...
...
@@ -35,7 +35,6 @@ LOCK(busyobj)
LOCK
(
cli
)
LOCK
(
exp
)
LOCK
(
hcb
)
LOCK
(
hcl
)
LOCK
(
hsl
)
LOCK
(
lru
)
LOCK
(
mempool
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment