}
sp->t_end = TIM_real();
- sp->wrk->idle = sp->t_end;
+ sp->wrk->used = sp->t_end;
if (sp->xid == 0) {
sp->t_req = sp->t_end;
sp->t_resp = sp->t_end;
assert(sp->xid == 0);
VCA_Prep(sp);
- sp->wrk->idle = sp->t_open;
+ sp->wrk->used = sp->t_open;
sp->wrk->acct.sess++;
SES_RefSrcAddr(sp);
do
/* Update stats of various sorts */
VSL_stats->client_req++; /* XXX not locked */
sp->t_req = TIM_real();
- sp->wrk->idle = sp->t_req;
+ sp->wrk->used = sp->t_req;
sp->wrk->acct.req++;
/* Assign XID and log */
#include <errno.h>
#include <stdio.h>
+#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
struct workreq *wrq;
AN(w->wrq);
+ w->used = NAN;
wrq = w->wrq;
CHECK_OBJ_NOTNULL(wrq->sess, SESS_MAGIC);
wrq->sess->wrk = w;
CHECK_OBJ(w->nobj, OBJECT_MAGIC);
if (w->nobjhead != NULL)
CHECK_OBJ(w->nobjhead, OBJHEAD_MAGIC);
+ assert(!isnan(w->used));
w->wrq = NULL;
}
w = &ww;
memset(w, 0, sizeof *w);
w->magic = WORKER_MAGIC;
- w->idle = TIM_real();
+ w->used = TIM_real();
w->wlp = w->wlog;
w->wle = w->wlog + sizeof w->wlog;
AZ(pipe(w->pipe));
LOCK(&qp->mtx);
TAILQ_INSERT_HEAD(&qp->idle, w, list);
- assert(w->idle != 0);
+ assert(!isnan(w->used));
UNLOCK(&qp->mtx);
assert(1 == read(w->pipe[0], &c, 1));
- if (w->idle == 0)
+ if (w->wrq == NULL)
break;
wrk_do_one(w);
}
LOCK(&qp->mtx);
w = TAILQ_LAST(&qp->idle, workerhead);
if (w != NULL &&
- (w->idle + params->wthread_timeout < now ||
+ (w->used + params->wthread_timeout < now ||
VSL_stats->n_wrk > params->wthread_max))
TAILQ_REMOVE(&qp->idle, w, list);
else
UNLOCK(&qp->mtx);
if (w == NULL)
continue;
- w->idle = 0;
+ AZ(w->wrq);
assert(1 == write(w->pipe[1], w, 1));
}
}