From 4a88128b01f33977dae353e80bb535d1e589a2b1 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Thu, 7 Oct 2010 18:19:02 +0000 Subject: [PATCH] Start the guard thread first, so we can handle signals from the very begining. Reported by: Mikolaj Golub MFC after: 1 week --- sbin/hastd/primary.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index 091c236eedee..27f43ca5850f 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -790,6 +790,12 @@ hastd_primary(struct hast_resource *res) init_local(res); init_ggate(res); init_environment(res); + /* + * Create the guard thread first, so we can handle signals from the + * very begining. + */ + error = pthread_create(&td, NULL, guard_thread, res); + assert(error == 0); /* * Create the control thread before sending any event to the parent, * as we can deadlock when parent sends control request to worker, @@ -812,9 +818,7 @@ hastd_primary(struct hast_resource *res) assert(error == 0); error = pthread_create(&td, NULL, ggate_send_thread, res); assert(error == 0); - error = pthread_create(&td, NULL, sync_thread, res); - assert(error == 0); - (void)guard_thread(res); + (void)sync_thread(res); } static void