From a5915eb1dd9b2b80f8afe11b272768eb94db390b Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 29 Mar 2023 17:37:48 +0200 Subject: [PATCH] MINOR: applet: Uninline appctx_free() This functin is uninlined and move in src/applet.c. It is mandatory to add traces for applets. --- include/haproxy/applet.h | 17 +---------------- src/applet.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h index e610ba4..b805440 100644 --- a/include/haproxy/applet.h +++ b/include/haproxy/applet.h @@ -46,6 +46,7 @@ void appctx_shut(struct appctx *appctx); struct appctx *appctx_new_on(struct applet *applet, struct sedesc *sedesc, int thr); int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buffer *input); void appctx_free_on_early_error(struct appctx *appctx); +void appctx_free(struct appctx *appctx); static inline struct appctx *appctx_new_here(struct applet *applet, struct sedesc *sedesc) { @@ -88,22 +89,6 @@ static inline void __appctx_free(struct appctx *appctx) _HA_ATOMIC_DEC(&nb_applets); } -static inline void appctx_free(struct appctx *appctx) -{ - /* The task is supposed to be run on this thread, so we can just - * check if it's running already (or about to run) or not - */ - if (!(appctx->t->state & (TASK_QUEUED | TASK_RUNNING))) - __appctx_free(appctx); - else { - /* if it's running, or about to run, defer the freeing - * until the callback is called. - */ - appctx->state |= APPLET_WANT_DIE; - task_wakeup(appctx->t, TASK_WOKEN_OTHER); - } -} - /* wakes up an applet when conditions have changed. We're using a macro here in * order to retrieve the caller's place. */ diff --git a/src/applet.c b/src/applet.c index 63ee155..a79bc63 100644 --- a/src/applet.c +++ b/src/applet.c @@ -125,6 +125,23 @@ void appctx_free_on_early_error(struct appctx *appctx) appctx_free(appctx); } +void appctx_free(struct appctx *appctx) +{ + /* The task is supposed to be run on this thread, so we can just + * check if it's running already (or about to run) or not + */ + if (!(appctx->t->state & (TASK_QUEUED | TASK_RUNNING))) { + __appctx_free(appctx); + } + else { + /* if it's running, or about to run, defer the freeing + * until the callback is called. + */ + appctx->state |= APPLET_WANT_DIE; + task_wakeup(appctx->t, TASK_WOKEN_OTHER); + } +} + /* reserves a command context of at least bytes in the , for * use by a CLI command or any regular applet. The pointer to this context is * stored in ctx.svcctx and is returned. The caller doesn't need to release -- 1.7.10.4