Mailing List Archive

[master] 3e2a73bc0 Brute force rename Lck_CondWait() to Lck_CondWaitUntil()
commit 3e2a73bc01f4366830fcf6a7689487444e2833a5
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Tue Oct 12 14:52:39 2021 +0000

Brute force rename Lck_CondWait() to Lck_CondWaitUntil()

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 14b5c0c09..f8e3514f2 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -690,7 +690,7 @@ extern pthread_mutexattr_t mtxattr_errorcheck;

/* public interface: */
void Lck_Delete(struct lock *lck);
-int Lck_CondWait(pthread_cond_t *cond, struct lock *lck, vtim_real);
+int Lck_CondWaitUntil(pthread_cond_t *cond, struct lock *lck, vtim_real);

#define Lck_New(a, b) Lck__New(a, b, #b)
#define Lck_Lock(a) Lck__Lock(a, __func__, __LINE__)
diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index 5fa8b1b7e..8d50d64b2 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -475,11 +475,11 @@ vbp_thread(struct worker *wrk, void *priv)
vt = VBH_root(vbp_heap);
if (vt == NULL) {
nxt = 8.192 + now;
- (void)Lck_CondWait(&vbp_cond, &vbp_mtx, nxt);
+ (void)Lck_CondWaitUntil(&vbp_cond, &vbp_mtx, nxt);
} else if (vt->due > now) {
nxt = vt->due;
vt = NULL;
- (void)Lck_CondWait(&vbp_cond, &vbp_mtx, nxt);
+ (void)Lck_CondWaitUntil(&vbp_cond, &vbp_mtx, nxt);
} else {
VBH_delete(vbp_heap, vt->heap_idx);
vt->due = now + vt->interval;
diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c
index d0990f410..c7c41e077 100644
--- a/bin/varnishd/cache/cache_ban_lurker.c
+++ b/bin/varnishd/cache/cache_ban_lurker.c
@@ -430,7 +430,7 @@ ban_lurker(struct worker *wrk, void *priv)
Lck_Lock(&ban_mtx);
if (gen == ban_generation) {
Pool_Sumstat(wrk);
- (void)Lck_CondWait(&ban_lurker_cond, &ban_mtx, d);
+ (void)Lck_CondWaitUntil(&ban_lurker_cond, &ban_mtx, d);
ban_batch = 0;
}
gen = ban_generation;
diff --git a/bin/varnishd/cache/cache_conn_pool.c b/bin/varnishd/cache/cache_conn_pool.c
index 4f4b1b210..a1ec971ea 100644
--- a/bin/varnishd/cache/cache_conn_pool.c
+++ b/bin/varnishd/cache/cache_conn_pool.c
@@ -500,7 +500,7 @@ VCP_Wait(struct worker *wrk, struct pfd *pfd, vtim_real tmo)
assert(pfd->cond == &wrk->cond);
Lck_Lock(&cp->mtx);
while (pfd->state == PFD_STATE_STOLEN) {
- r = Lck_CondWait(&wrk->cond, &cp->mtx, tmo);
+ r = Lck_CondWaitUntil(&wrk->cond, &cp->mtx, tmo);
if (r != 0) {
if (r == EINTR)
continue;
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 483e3c0b6..f712b693e 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -202,7 +202,7 @@ ved_include(struct req *preq, const char *src, const char *host,
assert(s == REQ_FSM_DISEMBARK);
Lck_Lock(&sp->mtx);
if (!ecx->woken)
- (void)Lck_CondWait(
+ (void)Lck_CondWaitUntil(
&ecx->preq->wrk->cond, &sp->mtx, 0);
Lck_Unlock(&sp->mtx);
AZ(req->wrk);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index a415fce59..c75c5d894 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -419,7 +419,7 @@ exp_thread(struct worker *wrk, void *priv)
} else if (tnext > t) {
VSL_Flush(&ep->vsl, 0);
Pool_Sumstat(wrk);
- (void)Lck_CondWait(&ep->condvar, &ep->mtx, tnext);
+ (void)Lck_CondWaitUntil(&ep->condvar, &ep->mtx, tnext);
}
Lck_Unlock(&ep->mtx);

diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index af3f306ed..a0aaaa907 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -208,7 +208,7 @@ Lck__Owned(const struct lock *lck)
}

int v_matchproto_()
-Lck_CondWait(pthread_cond_t *cond, struct lock *lck, vtim_real when)
+Lck_CondWaitUntil(pthread_cond_t *cond, struct lock *lck, vtim_real when)
{
struct ilck *ilck;
struct timespec ts;
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 76a90f9cf..e5cd2af28 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -257,7 +257,7 @@ ObjWaitExtend(const struct worker *wrk, const struct objcore *oc, uint64_t l)
assert(l <= rv || oc->boc->state == BOS_FAILED);
if (rv > l || oc->boc->state >= BOS_FINISHED)
break;
- (void)Lck_CondWait(&oc->boc->cond, &oc->boc->mtx, 0);
+ (void)Lck_CondWaitUntil(&oc->boc->cond, &oc->boc->mtx, 0);
}
rv = oc->boc->len_so_far;
Lck_Unlock(&oc->boc->mtx);
@@ -307,7 +307,7 @@ ObjWaitState(const struct objcore *oc, enum boc_state_e want)
while (1) {
if (oc->boc->state >= want)
break;
- (void)Lck_CondWait(&oc->boc->cond, &oc->boc->mtx, 0);
+ (void)Lck_CondWaitUntil(&oc->boc->cond, &oc->boc->mtx, 0);
}
Lck_Unlock(&oc->boc->mtx);
}
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index b8bc3efbd..02be15c81 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -42,7 +42,7 @@
*
* In our case, any worker thread which we wake up comes from the idle queue,
* where it put itself under the mutex, releasing that mutex implicitly via
- * Lck_CondWait() (which calls some variant of pthread_cond_wait). So we avoid
+ * Lck_CondWaitUntil() (which calls some variant of pthread_cond_wait). So we avoid
* additional mutex contention knowing that any worker thread on the idle queue
* is blocking on the cv.
*
@@ -440,7 +440,7 @@ Pool_Work_Thread(struct pool *pp, struct worker *wrk)
tmo = now + 1.;
else
tmo = now + 60.;
- (void)Lck_CondWait(&wrk->cond, &pp->mtx, tmo);
+ (void)Lck_CondWaitUntil(&wrk->cond, &pp->mtx, tmo);
if (wrk->task->func != NULL) {
/* We have been handed a new task */
tpx = *wrk->task;
@@ -697,13 +697,13 @@ pool_herder(void *priv)
if (pp->lqueue == 0) {
if (DO_DEBUG(DBG_VTC_MODE))
delay = 0.5;
- r = Lck_CondWait(&pp->herder_cond, &pp->mtx,
+ r = Lck_CondWaitUntil(&pp->herder_cond, &pp->mtx,
VTIM_real() + delay);
} else if (pp->nthr >= cache_param->wthread_max) {
/* XXX: unsafe counters */
if (r != ETIMEDOUT)
VSC_C_main->threads_limited++;
- r = Lck_CondWait(&pp->herder_cond, &pp->mtx,
+ r = Lck_CondWaitUntil(&pp->herder_cond, &pp->mtx,
VTIM_real() + 1.0);
}
Lck_Unlock(&pp->mtx);
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index a9ce140bc..4d9dc37b1 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -1038,7 +1038,7 @@ h2_vfp_body(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr, ssize_t *lp)
if (retval != VFP_OK || l > 0)
break;

- i = Lck_CondWait(r2->cond, &h2->sess->mtx,
+ i = Lck_CondWaitUntil(r2->cond, &h2->sess->mtx,
VTIM_real() + SESS_TMO(h2->sess, timeout_idle));
if (i == ETIMEDOUT) {
retval = VFP_ERROR;
diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index a684b9488..a1439c0a5 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -59,7 +59,7 @@ h2_cond_wait(pthread_cond_t *cond, struct h2_sess *h2, struct h2_req *r2)
if (cache_param->idle_send_timeout > 0.)
when = now + cache_param->idle_send_timeout;

- r = Lck_CondWait(cond, &h2->sess->mtx, when);
+ r = Lck_CondWaitUntil(cond, &h2->sess->mtx, when);
assert(r == 0 || r == ETIMEDOUT);

now = VTIM_real();
@@ -100,7 +100,7 @@ h2_send_get_locked(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
r2->wrk = wrk;
VTAILQ_INSERT_TAIL(&h2->txqueue, r2, tx_list);
while (!H2_SEND_HELD(h2, r2))
- AZ(Lck_CondWait(&wrk->cond, &h2->sess->mtx, 0));
+ AZ(Lck_CondWaitUntil(&wrk->cond, &h2->sess->mtx, 0));
r2->wrk = NULL;
}

diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 5d4e3ecd6..899f2ec56 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -429,7 +429,7 @@ h2_new_session(struct worker *wrk, void *arg)
VTAILQ_FOREACH(r2, &h2->streams, list)
VSLb(h2->vsl, SLT_Debug, "ST %u %d",
r2->stream, r2->state);
- (void)Lck_CondWait(h2->cond, &h2->sess->mtx, VTIM_real() + .1);
+ (void)Lck_CondWaitUntil(h2->cond, &h2->sess->mtx, VTIM_real() + .1);
Lck_Unlock(&h2->sess->mtx);
}
h2->cond = NULL;
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit