[master] ae3733f Move Pool_Wait() to WAIT_Enter() where it belongs
Poul-Henning Kamp
phk at varnish-cache.org
Mon Dec 19 11:19:04 CET 2011
commit ae3733fb53a2c4fb21a720eb834dcc43b90d0577
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Dec 19 10:18:46 2011 +0000
Move Pool_Wait() to WAIT_Enter() where it belongs
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 9601270..0270f3b 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -868,7 +868,6 @@ void PipeSession(struct sess *sp);
/* cache_pool.c */
void Pool_Init(void);
void Pool_Work_Thread(void *priv, struct worker *w);
-void Pool_Wait(struct sess *sp);
int Pool_Schedule(struct pool *pp, struct sess *sp);
#define WRW_IsReleased(w) ((w)->wrw.wfd == NULL)
@@ -893,6 +892,7 @@ void SES_Charge(struct sess *sp);
struct sesspool *SES_NewPool(struct pool *pp);
void SES_DeletePool(struct sesspool *sp, struct worker *wrk);
int SES_Schedule(struct sess *sp);
+void SES_Handle(struct sess *sp, int status);
/* cache_shmlog.c */
@@ -964,6 +964,11 @@ void ESI_DeliverChild(const struct sess *);
/* cache_vrt_vmod.c */
void VMOD_Init(void);
+/* cache_waiter.c */
+void WAIT_Enter(struct sess *sp);
+void WAIT_Init(void);
+const char *WAIT_GetName(void);
+
/* cache_wrk.c */
void WRK_Init(void);
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index aed15ee..520c620 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -121,7 +121,7 @@ cnt_wait(struct sess *sp)
WSP(sp, SLT_Debug, "herding");
wrk->stats.sess_herd++;
SES_Charge(sp);
- Pool_Wait(sp);
+ WAIT_Enter(sp);
return (1);
}
if (i == 1) {
@@ -432,7 +432,7 @@ WSP(sp, SLT_Debug, "PHK req %.9f resp %.9f end %.9f open %.9f",
return (0);
}
wrk->stats.sess_herd++;
- Pool_Wait(sp);
+ WAIT_Enter(sp);
return (1);
}
diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index a4d8a28..e59bbd0 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -48,8 +48,6 @@
#include "cache.h"
#include "common/heritage.h"
-#include "waiter/waiter.h"
-#include "vtcp.h"
#include "vtim.h"
/*--------------------------------------------------------------------
@@ -82,8 +80,6 @@ pthread_condattr_setclock(pthread_condattr_t *attr, int foo)
}
#endif /* !CLOCK_MONOTONIC */
-static void *waiter_priv;
-
VTAILQ_HEAD(workerhead, worker);
struct poolsock {
@@ -350,29 +346,6 @@ Pool_Schedule(struct pool *pp, struct sess *sp)
}
/*--------------------------------------------------------------------
- * Wait for another request
- */
-
-void
-Pool_Wait(struct sess *sp)
-{
-
- CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
- AZ(sp->vcl);
- assert(sp->fd >= 0);
- sp->wrk = NULL;
-
- /*
- * Set nonblocking in the worker-thread, before passing to the
- * acceptor thread, to reduce syscall density of the latter.
- */
- if (VTCP_nonblocking(sp->fd))
- SES_Close(sp, "remote closed");
- waiter->pass(waiter_priv, sp);
-}
-
-/*--------------------------------------------------------------------
* Create another thread, if necessary & possible
*/
@@ -588,7 +561,6 @@ void
Pool_Init(void)
{
- waiter_priv = waiter->init();
Lck_New(&pool_mtx, lck_wq);
AZ(pthread_create(&thr_pool_herder, NULL, pool_poolherder, NULL));
}
diff --git a/bin/varnishd/waiter/cache_waiter.c b/bin/varnishd/waiter/cache_waiter.c
index bf5717b..8aa8684 100644
--- a/bin/varnishd/waiter/cache_waiter.c
+++ b/bin/varnishd/waiter/cache_waiter.c
@@ -33,10 +33,14 @@
#include <unistd.h>
#include <string.h>
-#include "common/common.h"
+#include "cache/cache.h"
#include "waiter/waiter.h"
+#include "vtcp.h"
+
+static void *waiter_priv;
+
const char *
WAIT_GetName(void)
{
@@ -55,4 +59,24 @@ WAIT_Init(void)
AN(waiter->name);
AN(waiter->init);
AN(waiter->pass);
+ waiter_priv = waiter->init();
+}
+
+void
+WAIT_Enter(struct sess *sp)
+{
+
+ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
+ AZ(sp->vcl);
+ assert(sp->fd >= 0);
+ sp->wrk = NULL;
+
+ /*
+ * Set nonblocking in the worker-thread, before passing to the
+ * acceptor thread, to reduce syscall density of the latter.
+ */
+ if (VTCP_nonblocking(sp->fd))
+ SES_Close(sp, "remote closed");
+ waiter->pass(waiter_priv, sp);
}
diff --git a/bin/varnishd/waiter/waiter.h b/bin/varnishd/waiter/waiter.h
index e9c3cdc..9f48884 100644
--- a/bin/varnishd/waiter/waiter.h
+++ b/bin/varnishd/waiter/waiter.h
@@ -56,10 +56,3 @@ extern const struct waiter waiter_ports;
#endif
extern const struct waiter waiter_poll;
-
-/* cache_session.c */
-void SES_Handle(struct sess *sp, int status);
-
-/* cache_waiter.c */
-const char *WAIT_GetName(void);
-void WAIT_Init(void);
More information about the varnish-commit
mailing list