]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: shctx: Add new reserve_finish callback call to shctx_row_reserve_hot
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Thu, 16 Nov 2023 16:38:24 +0000 (17:38 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 16 Nov 2023 18:35:10 +0000 (19:35 +0100)
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.

include/haproxy/shctx-t.h
src/shctx.c

index 9d23d69d089ce90d41dc224769218640b70845a6..da241a9ac474f808057e16e9f466fd709a2d6ade 100644 (file)
@@ -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];
index daf7866c9e6e5f2ab6aa82806d2a8f775fa09ad8..299f57f2adb51944576ba2d8cae4ab00c14ff168 100644 (file)
@@ -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;
 }