X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Flttng.c;h=36d4c913df48ab681cbfac27e428c3f7888d339c;hp=e60b694e43729ab1c7ced011e11c2cae3a5e5433;hb=af87c45a6179026e263c3a9eb251ccf8ec9537e7;hpb=852fdd0c1f836d379f8985b8df3186dc6b7daa44 diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index e60b694e4..36d4c913d 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -316,19 +316,20 @@ static int spawn_sessiond(char *pathname) } else if (pid > 0) { sessiond_pid = pid; /* - * Wait for lttng-sessiond to start. We need to use a - * flag to check if the signal has been sent to us, - * because the child can be scheduled before the parent, - * and thus send the signal before this check. In the - * signal handler, we set the recv_child_signal flag, so - * anytime we check it after the fork is fine. Note that - * sleep() is interrupted before the 1 second delay as - * soon as the signal is received, so it will not cause - * visible delay for the user. + * Wait for lttng-sessiond to start. We need to use a flag to check if + * the signal has been sent to us, because the child can be scheduled + * before the parent, and thus send the signal before this check. In + * the signal handler, we set the recv_child_signal flag, so anytime we + * check it after the fork is fine. Note that sleep() is interrupted + * before the 1 second delay as soon as the signal is received, so it + * will not cause visible delay for the user. */ while (!recv_child_signal) { sleep(1); } + /* + * The signal handler will nullify sessiond_pid on SIGCHLD + */ if (!sessiond_pid) { exit(EXIT_FAILURE); }