From a3029c5a2e71d4aa4955901f282d3f4669acf97d Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 5 Mar 2023 15:47:49 +0100 Subject: Place _cmd_pids in object not header to avoid unsused variables --- lib/utils_cmd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/utils_cmd.c') diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 34fb3909..883f1ec1 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -42,6 +42,16 @@ #include "common.h" #include "utils.h" #include "utils_cmd.h" +/* This variable must be global, since there's no way the caller + * can forcibly slay a dead or ungainly running program otherwise. + * Multithreading apps and plugins can initialize it (via CMD_INIT) + * in an async safe manner PRIOR to calling cmd_run() or cmd_run_array() + * for the first time. + * + * The check for initialized values is atomic and can + * occur in any number of threads simultaneously. */ +static pid_t *_cmd_pids = NULL; + #include "utils_base.h" #include -- cgit v1.2.3-74-g34f1