[collectd] [PATCH] email plugin: kill threads before closing the associated socket

Sebastian Harl sh<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>tokkee.org
Tue Dec 12 10:50:12 CET 2006


If the socket is closed before the thread is terminated it might cause some
confusing error messages if the thread wants to read from the socket.

Signed-off-by: Sebastian Harl <sh<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>tokkee.org>
---
 src/email.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/email.c b/src/email.c
index 377a6b1..0f9c2f3 100644
--- a/src/email.c
+++ b/src/email.c
@@ -685,15 +685,15 @@ static void email_shutdown (void)
 	if (disabled)
 		return;
 
-	close (connector_socket);
 	pthread_kill (connector, SIGTERM);
+	close (connector_socket);
 
 	/* don't allow any more connections to be processed */
 	pthread_mutex_lock (&conns_mutex);
 
 	for (i = 0; i < max_conns; ++i) {
-		close (collectors[i]->socket);
 		pthread_kill (collectors[i]->thread, SIGTERM);
+		close (collectors[i]->socket);
 	}
 
 	pthread_mutex_unlock (&conns_mutex);
-- 
1.4.3.2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20061212/78fa7353/attachment.pgp


More information about the collectd mailing list