helper_thread: do not send A_EXIT message when exit is called
authorVincent Fu <vincent.fu@samsung.com>
Tue, 23 Jan 2024 21:56:31 +0000 (21:56 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 13 Feb 2024 16:44:43 +0000 (11:44 -0500)
When helper_thread_exit() is called, it uses two means to tell
helper_thread_main() to stop. It sends an A_EXIT message via the pipes
used for inter-process communication and it also sets the exit flag in
struct helper_data.

When helper_thread_main() receives the A_EXIT message, it immediately
breaks out of its main loop without carrying out any further activity
such as recording final log entries. This leads to missing final log
entries when log_avg_msec is enabled.

Removing the A_EXIT message helps resolve this issue in some cases as
with its removal the actions in the body of the loop have an opportunity
to be taken before checking the flag in struct helper_data.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
helper_thread.c

index 2a9dabf5f7e0b27053f7460327ab37f41eb721d1..332ccb53c254e45087919f9a1f758390a9873f2f 100644 (file)
@@ -161,7 +161,6 @@ void helper_thread_exit(void)
                return;
 
        helper_data->exit = 1;
-       submit_action(A_EXIT);
        pthread_join(helper_data->thread, NULL);
 }