[master] 83387b8 Initialize pthreads stuff before we use it.

Poul-Henning Kamp phk at varnish-cache.org
Wed Aug 22 11:07:41 CEST 2012


commit 83387b8ba36c9793370e99b79688c9cc9cae0ef7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Aug 22 09:07:09 2012 +0000

    Initialize pthreads stuff before we use it.
    
    Spotted by: OSX pthread implementation

diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index 21a8a31..336c76a 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -418,6 +418,8 @@ pool_mkpool(unsigned pool_no)
 	VTAILQ_INIT(&pp->back_queue);
 	pp->sesspool = SES_NewPool(pp, pool_no);
 	AN(pp->sesspool);
+	AZ(pthread_cond_init(&pp->herder_cond, NULL));
+	AZ(pthread_create(&pp->herder_thr, NULL, pool_herder, pp));
 
 	VTAILQ_FOREACH(ls, &heritage.socks, list) {
 		if (ls->sock < 0)
@@ -430,9 +432,6 @@ pool_mkpool(unsigned pool_no)
 		AZ(Pool_Task(pp, &ps->task, POOL_QUEUE_BACK));
 	}
 
-	AZ(pthread_cond_init(&pp->herder_cond, NULL));
-	AZ(pthread_create(&pp->herder_thr, NULL, pool_herder, pp));
-
 	return (pp);
 }
 



More information about the varnish-commit mailing list