diff --git a/core/daemon_cmd.c b/core/daemon_cmd.c index 9d80cf4..b558942 100644 --- a/core/daemon_cmd.c +++ b/core/daemon_cmd.c @@ -29,9 +29,16 @@ int cmd_exit(void **args) { item *i, *j; + fbsplash_profile("cmd exit handler entry point\n"); + pthread_cancel(th_switchmon); + + fbsplash_profile("th_switchmon cancelled\n"); + pthread_mutex_lock(&mtx_paint); + fbsplash_profile("mtx paint acquired\n"); + if (ctty == CTTY_SILENT) { if (config.effects & FBSPL_EFF_FADEOUT) fbsplashr_render_screen(theme, true, false, FBSPL_EFF_FADEOUT); @@ -45,9 +52,13 @@ int cmd_exit(void **args) pthread_mutex_unlock(&mtx_paint); + fbsplash_profile("about to kill the sighandler thread\n"); + pthread_kill(th_sighandler, SIGINT); pthread_join(th_sighandler, NULL); + fbsplash_profile("sighandler thread killed\n"); + fbsplashr_theme_free(theme); fbsplashr_cleanup(); fbsplash_lib_cleanup(); @@ -59,6 +70,8 @@ int cmd_exit(void **args) i = j; } + fbsplash_profile("about to exit\n"); + exit(0); /* We never get here */