From: Remi Tricot-Le Breton Date: Thu, 16 Nov 2023 16:38:24 +0000 (+0100) Subject: MINOR: shctx: Add new reserve_finish callback call to shctx_row_reserve_hot X-Git-Tag: v2.9-dev10~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cd91b4f2aee0e7cfd0e89be579311c6d26d622d;p=thirdparty%2Fhaproxy.git MINOR: shctx: Add new reserve_finish callback call to shctx_row_reserve_hot This patch adds a reserve_finish callback that can be defined by the subsystems that require a shared_context. It is called at the end of shctx_row_reserve_hot after the shared_context lock is released. --- diff --git a/include/haproxy/shctx-t.h b/include/haproxy/shctx-t.h index 9d23d69d08..da241a9ac4 100644 --- a/include/haproxy/shctx-t.h +++ b/include/haproxy/shctx-t.h @@ -51,6 +51,7 @@ struct shared_context { unsigned int nbav; /* number of available blocks */ unsigned int max_obj_size; /* maximum object size (in bytes). */ void (*free_block)(struct shared_block *first, struct shared_block *block, void *data); + void (*reserve_finish)(struct shared_context *shctx); void *cb_data; short int block_size; unsigned char data[VAR_ARRAY]; diff --git a/src/shctx.c b/src/shctx.c index daf7866c9e..299f57f2ad 100644 --- a/src/shctx.c +++ b/src/shctx.c @@ -110,6 +110,9 @@ struct shared_block *shctx_row_reserve_hot(struct shared_context *shctx, shctx_wrunlock(shctx); + if (shctx->reserve_finish) + shctx->reserve_finish(shctx); + out: return ret; }