Skip to content

Commit

Permalink
shrink the critical section under the pool mutex by a bit
Browse files Browse the repository at this point in the history
Checking and preparing our worker struct does not need to happen
under the lock.
  • Loading branch information
nigoroll committed Sep 27, 2018
1 parent a2acba9 commit d8cc41b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bin/varnishd/cache/cache_wrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,12 @@ Pool_Work_Thread(struct pool *pp, struct worker *wrk)
CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
wrk->pool = pp;
while (1) {
Lck_Lock(&pp->mtx);

CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);

WS_Reset(wrk->aws, 0);
AZ(wrk->vsl);

Lck_Lock(&pp->mtx);
if (pp->nidle < pool_reserve())
prio_lim = TASK_QUEUE_RESERVE + 1;
else
Expand Down

0 comments on commit d8cc41b

Please sign in to comment.