From: Florian Forster Date: Tue, 27 Mar 2007 14:31:22 +0000 (+0200) Subject: network plugin: Fix shutdown code. X-Git-Tag: collectd-4.0.0-rc4~46 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=beee49e8db308987c19bb16e93f0f8c8b435d773;p=collectd.git network plugin: Fix shutdown code. --- diff --git a/src/network.c b/src/network.c index b5d8efb4..35ffb393 100644 --- a/src/network.c +++ b/src/network.c @@ -1118,13 +1118,24 @@ static int network_shutdown (void) listen_loop++; - pthread_kill (listen_thread, SIGTERM); - pthread_join (listen_thread, NULL /* no return value */); + if (listen_thread != (pthread_t) 0) + { + pthread_kill (listen_thread, SIGTERM); + pthread_join (listen_thread, NULL /* no return value */); + listen_thread = (pthread_t) 0; + } listen_thread = 0; + /* TODO: Close `sending_sockets' */ + + plugin_unregister_config ("network"); + plugin_unregister_init ("network"); + plugin_unregister_write ("network"); + plugin_unregister_shutdown ("network"); + return (0); -} +} /* int network_shutdown */ static int network_init (void) {