Code

sysdbd: Send SIGINT to backend thread when shutting down.
authorSebastian Harl <sh@tokkee.org>
Tue, 10 Dec 2013 08:16:35 +0000 (09:16 +0100)
committerSebastian Harl <sh@tokkee.org>
Tue, 10 Dec 2013 08:16:35 +0000 (09:16 +0100)
This will interrupt the sleep call and make the thread shut down faster.

src/daemon/sysdbd.c

index 4fbf48f449b1eca24b4dc4bcdd7db346fe807da8..67d4515600f469f7806129822a128863a67948e7 100644 (file)
@@ -171,6 +171,7 @@ static void *
 backend_handler(void __attribute__((unused)) *data)
 {
        sdb_plugin_collector_loop(&plugin_main_loop);
+       sdb_log(SDB_LOG_INFO, "Shutting down backend thread");
        return NULL;
 } /* backend_handler */
 
@@ -281,6 +282,7 @@ main(int argc, char **argv)
 
                sdb_log(SDB_LOG_INFO, "Waiting for backend thread to terminate");
                plugin_main_loop.do_loop = 0;
+               pthread_kill(backend_thread, SIGINT);
                pthread_join(backend_thread, NULL);
                sdb_fe_sock_destroy(sock);
        }