mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-10 12:11:28 +01:00
MINOR: applet: Uninline appctx_free()
This functin is uninlined and move in src/applet.c. It is mandatory to add traces for applets.
This commit is contained in:
parent
947b2e5922
commit
a5915eb1dd
@ -46,6 +46,7 @@ void appctx_shut(struct appctx *appctx);
|
|||||||
struct appctx *appctx_new_on(struct applet *applet, struct sedesc *sedesc, int thr);
|
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);
|
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_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)
|
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);
|
_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
|
/* wakes up an applet when conditions have changed. We're using a macro here in
|
||||||
* order to retrieve the caller's place.
|
* order to retrieve the caller's place.
|
||||||
*/
|
*/
|
||||||
|
|||||||
17
src/applet.c
17
src/applet.c
@ -125,6 +125,23 @@ void appctx_free_on_early_error(struct appctx *appctx)
|
|||||||
appctx_free(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 <size> bytes in the <appctx>, for
|
/* reserves a command context of at least <size> bytes in the <appctx>, for
|
||||||
* use by a CLI command or any regular applet. The pointer to this context is
|
* 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
|
* stored in ctx.svcctx and is returned. The caller doesn't need to release
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user