summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2010-10-07 18:19:02 +0000
committerpjd <pjd@FreeBSD.org>2010-10-07 18:19:02 +0000
commit3293cba127d45cdf828b9cbdffbe7fdbfa00b989 (patch)
treef7ead6481468fae06e4fb059feeebbd081a4da6e /sbin
parent52123d52726c193dbe67c32b4a0b4f857c2326bb (diff)
downloadFreeBSD-src-3293cba127d45cdf828b9cbdffbe7fdbfa00b989.zip
FreeBSD-src-3293cba127d45cdf828b9cbdffbe7fdbfa00b989.tar.gz
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
Diffstat (limited to 'sbin')
-rw-r--r--sbin/hastd/primary.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c
index 091c236..27f43ca 100644
--- a/sbin/hastd/primary.c
+++ b/sbin/hastd/primary.c
@@ -791,6 +791,12 @@ hastd_primary(struct hast_resource *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,
* but worker has no control thread started yet, so parent waits.
@@ -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
OpenPOWER on IntegriCloud