From: phk Date: Sun, 17 Sep 2006 18:30:05 +0000 (+0000) Subject: Use the worker pools in round-robin fashion. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=329f3e159e2a1af75184db50b5a539c5e4c5ab79;p=varnish Use the worker pools in round-robin fashion. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1049 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index 04a815a1..934bee12 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -238,9 +238,15 @@ WRK_QueueSession(struct sess *sp) struct worker *w; pthread_t tp; struct wq *qp; + static unsigned nq; + unsigned onq; + onq = nq + 1; + if (onq > nwq) + onq = 0; sp->workreq.sess = sp; - qp = wq[sp->fd % nwq]; + qp = wq[onq]; + nq = onq; LOCK(&qp->mtx);