r844 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Sun Aug 20 13:19:21 CEST 2006
Author: phk
Date: 2006-08-20 13:19:20 +0200 (Sun, 20 Aug 2006)
New Revision: 844
Modified:
trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
Respect lower pool limit dynamically
Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-20 07:32:50 UTC (rev 843)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-08-20 11:19:20 UTC (rev 844)
@@ -160,6 +160,7 @@
struct worker *w, ww;
struct timespec ts;
+ (void)priv;
w = &ww;
memset(w, 0, sizeof *w);
w->magic = WORKER_MAGIC;
@@ -168,10 +169,8 @@
AZ(pthread_mutex_lock(&wrk_mtx));
w->nbr = VSL_stats->n_wrk;
- if (priv == NULL) {
- VSL_stats->n_wrk_create++;
- VSL(SLT_WorkThread, 0, "%u born dynamic", w->nbr);
- }
+ VSL_stats->n_wrk_create++;
+ VSL(SLT_WorkThread, 0, "%u born", w->nbr);
TAILQ_INSERT_HEAD(&wrk_busy, w, list);
while (1) {
CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
@@ -187,7 +186,7 @@
TAILQ_INSERT_HEAD(&wrk_idle, w, list);
/* If we are a reserved thread we don't die */
- if (priv != NULL) {
+ if (w->nbr < params->wthread_min) {
AZ(pthread_cond_wait(&w->cv, &wrk_mtx));
} else {
/* If we are a dynamic thread, time out and die */
@@ -276,7 +275,7 @@
VSL(SLT_Debug, 0, "Starting %u worker threads", params->wthread_min);
for (i = 0; i < params->wthread_min; i++) {
VSL_stats->n_wrk++;
- AZ(pthread_create(&tp, NULL, wrk_thread, &i));
+ AZ(pthread_create(&tp, NULL, wrk_thread, NULL));
AZ(pthread_detach(tp));
}
}
More information about the varnish-commit
mailing list