Skip to content
Browse files

Set+check the startup status of the local listener thread. If it does…

… not start then the main thread should abort not continue starting child threads.
  • Loading branch information...
1 parent 10bbe07 commit 4f9f91876807f672e295ee76539395076c74e7ba @ssinger ssinger committed Jul 13, 2010
Showing with 13 additions and 1 deletion.
  1. +3 −0 src/slon/local_listen.c
  2. +9 −0 src/slon/slon.c
  3. +1 −1 src/slon/slon.h
View
3 src/slon/local_listen.c
@@ -78,6 +78,7 @@ 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_retry();
@@ -111,6 +112,7 @@ 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();
@@ -122,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);
View
9 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);
/*
View
2 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

0 comments on commit 4f9f918

Please sign in to comment.
Something went wrong with that request. Please try again.