Start the guard thread first, so we can handle signals from the very begining.

Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2010-10-07 18:19:02 +00:00
parent b46198a5db
commit 4a88128b01
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=213530

View File

@ -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