Steve Singer ssinger at ca.afilias.info
Tue Jul 13 06:02:54 PDT 2010
---
 src/slon/local_listen.c |    9 +++++++++
 src/slon/slon.c         |    9 +++++++++
 src/slon/slon.h         |    2 +-
 3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/src/slon/local_listen.c b/src/slon/local_listen.c
index e10efe7..9290ac5 100644
--- a/src/slon/local_listen.c
+++ b/src/slon/local_listen.c
@@ -77,6 +77,10 @@ localListenThread_main(/* @unused@ */ void *dummy)
 				 dstring_data(&query1), PQresultErrorMessage(res));
 		PQclear(res);
 		dstring_free(&query1);
+		pthread_mutex_lock(&slon_wait_listen_lock);
+		slon_listen_started=0;
+		pthread_cond_signal(&slon_wait_listen_cond);
+		pthread_mutex_unlock(&slon_wait_listen_lock);
 		slon_retry();
 	}
 	PQclear(res);
@@ -107,6 +111,10 @@ localListenThread_main(/* @unused@ */ void *dummy)
 		    
 		PQclear(res);
 		dstring_free(&query1);
+		pthread_mutex_lock(&slon_wait_listen_lock);
+		slon_listen_started=0;
+		pthread_cond_signal(&slon_wait_listen_cond);
+		pthread_mutex_unlock(&slon_wait_listen_lock);
 		slon_abort();
 	}
 	PQclear(res);
@@ -116,6 +124,7 @@ localListenThread_main(/* @unused@ */ void *dummy)
 	 * other threads.
 	 */
 	pthread_mutex_lock(&slon_wait_listen_lock);
+	slon_listen_started=1;
 	pthread_cond_signal(&slon_wait_listen_cond);
 	pthread_mutex_unlock(&slon_wait_listen_lock);
 
diff --git a/src/slon/slon.c b/src/slon/slon.c
index 627de17..de05635 100644
--- a/src/slon/slon.c
+++ b/src/slon/slon.c
@@ -53,6 +53,7 @@ int			sched_wakeuppipe[2];
 
 pthread_mutex_t slon_wait_listen_lock;
 pthread_cond_t slon_wait_listen_cond;
+int            slon_listen_started=0;
 
 /* ---------- 
  * Local data 
@@ -695,6 +696,14 @@ SlonMain(void)
 		slon_retry();
 	}
 	pthread_cond_wait(&slon_wait_listen_cond, &slon_wait_listen_lock);
+	if(!slon_listen_started)
+	{
+		/**
+		 * The local listen thread did not start up properly.
+		 */
+		slon_log(SLON_FATAL,"main: localListenThread did not start\n");
+		slon_abort();
+	}
 	pthread_mutex_unlock(&slon_wait_listen_lock);
 
 	/*
diff --git a/src/slon/slon.h b/src/slon/slon.h
index b6e509a..57c1bf1 100644
--- a/src/slon/slon.h
+++ b/src/slon/slon.h
@@ -419,7 +419,7 @@ extern void Usage(char *const argv[]);
 extern int	sched_wakeuppipe[];
 extern pthread_mutex_t slon_wait_listen_lock;
 extern pthread_cond_t slon_wait_listen_cond;
-
+extern int slon_listen_started;
 
 /* ----------
  * Functions in runtime_config.c
-- 
1.6.3.3


--------------010805010706030806040109--


More information about the Slony1-patches mailing list