svn commit: r213530 - head/sbin/hastd

Pawel Jakub Dawidek pjd at FreeBSD.org
Thu Oct 7 18:19:03 UTC 2010


Author: pjd
Date: Thu Oct  7 18:19:02 2010
New Revision: 213530
URL: http://svn.freebsd.org/changeset/base/213530

Log:
  Start the guard thread first, so we can handle signals from the very begining.
  
  Reported by:	Mikolaj Golub <to.my.trociny at gmail.com>
  MFC after:	1 week

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Thu Oct  7 18:16:22 2010	(r213529)
+++ head/sbin/hastd/primary.c	Thu Oct  7 18:19:02 2010	(r213530)
@@ -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


More information about the svn-src-head mailing list