[master] 7028d5298 Cleanup and sum up after bgthread termination

Nils Goroll nils.goroll at uplex.de
Mon Oct 3 14:33:03 UTC 2022


commit 7028d529887b36c04703b86bd0e59c36cfc824ed
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Sep 23 10:40:07 2022 +0200

    Cleanup and sum up after bgthread termination
    
    Strictly speaking, these calls were already missing before
    3a22f5f0ded31f8c7340ac00a382ae9106c20a8c, but now that bgthreads are
    officially allowed to terminate, we should really finalize & cleanup
    the wpriv and stats structs to provide a consistent interface.

diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 0b8bd087e..b008f95ae 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -89,6 +89,7 @@ wrk_bgthread(void *arg)
 	struct worker wrk;
 	struct worker_priv wpriv[1];
 	struct VSC_main_wrk ds;
+	void *r;
 
 	CAST_OBJ_NOTNULL(bt, arg, BGTHREAD_MAGIC);
 	THR_SetName(bt->name);
@@ -100,7 +101,10 @@ wrk_bgthread(void *arg)
 	memset(&ds, 0, sizeof ds);
 	wrk.stats = &ds;
 
-	return (bt->func(&wrk, bt->priv));
+	r = bt->func(&wrk, bt->priv);
+	HSH_Cleanup(&wrk);
+	Pool_Sumstat(&wrk);
+	return (r);
 }
 
 void


More information about the varnish-commit mailing list