diff --git a/src/debug.c b/src/debug.c index dfd44f5a2..679a4e127 100644 --- a/src/debug.c +++ b/src/debug.c @@ -470,24 +470,21 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx) */ static int cli_io_handler_show_threads(struct appctx *appctx) { - int thr; + int *thr = appctx->svcctx; - if (appctx->st0) - thr = appctx->st1; - else - thr = 0; + if (!thr) + thr = applet_reserve_svcctx(appctx, sizeof(*thr)); do { chunk_reset(&trash); - ha_thread_dump(&trash, thr); + ha_thread_dump(&trash, *thr); if (applet_putchk(appctx, &trash) == -1) { /* failed, try again */ - appctx->st1 = thr; return 0; } - thr++; - } while (thr < global.nbthread); + (*thr)++; + } while (*thr < global.nbthread); return 1; }