CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
assert(!isnan(w->used));
- LOCK(&tmtx);
-
- /* Process overflow requests, if any */
w->wrq = TAILQ_FIRST(&overflow);
if (w->wrq != NULL) {
- VSL_stats->n_wrk_queue--;
- TAILQ_REMOVE(&overflow, w->wrq, list);
- } else {
+ LOCK(&tmtx);
+
+ /* Process overflow requests, if any */
+ w->wrq = TAILQ_FIRST(&overflow);
+ if (w->wrq != NULL) {
+ VSL_stats->n_wrk_queue--;
+ TAILQ_REMOVE(&overflow, w->wrq, list);
+ }
+ UNLOCK(&tmtx);
+ }
+ if (w->wrq == NULL) {
+ LOCK(&qp->mtx);
TAILQ_INSERT_HEAD(&qp->idle, w, list);
- }
-
- UNLOCK(&qp->mtx);
-
- if (w->wrq == NULL)
+ UNLOCK(&qp->mtx);
assert(1 == read(w->pipe[0], &c, 1));
+ }
if (w->wrq == NULL)
break;
wrk_do_one(w);
static struct objhead *
hcl_lookup(struct sess *sp, struct objhead *noh)
{
+ struct objhead *roh;
struct hcl_entry *he, *he2;
struct hcl_hd *hp;
unsigned u1, digest, r;
unsigned u, v;
int i;
- CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC);
+ CHECK_OBJ_ORNULL(noh, OBJHEAD_MAGIC);
digest = ~0U;
for (u = 0; u < sp->ihashptr; u += 2) {
if (i > 0)
break;
he->refcnt++;
- noh = he->oh;
+ roh = he->oh;
UNLOCK(&hp->mtx);
if (he2 != NULL)
free(he2);
- return (noh);
+ if (noh->hash != NULL) {
+ free(noh->hash);
+ noh->hash = NULL;
+ }
+ return (roh);
}
if (noh == NULL) {
UNLOCK(&hp->mtx);
he2->head = hp;
noh->hashpriv = he2;
+ AZ(noh->hash);
noh->hash = malloc(sp->lhashptr);
XXXAN(noh->hash);
noh->hashlen = sp->lhashptr;