summaryrefslogtreecommitdiffstats
path: root/src/plugins_d.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins_d.c')
-rw-r--r--src/plugins_d.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/plugins_d.c b/src/plugins_d.c
index 627cc90e5..0030e2216 100644
--- a/src/plugins_d.c
+++ b/src/plugins_d.c
@@ -109,7 +109,7 @@ void *pluginsd_worker_thread(void *arg)
size_t count = 0;
- while(likely(1)) {
+ for(;;) {
if(unlikely(netdata_exit)) break;
FILE *fp = mypopen(cd->cmd, &cd->pid);
@@ -358,7 +358,7 @@ void *pluginsd_worker_thread(void *arg)
error("PLUGINSD: %s sleeping for %llu. Will kill with SIGCONT pid %d to wake it up.\n", cd->fullfilename, susec, cd->pid);
usleep(susec);
killpid(cd->pid, SIGCONT);
- bcopy(&now, &last, sizeof(struct timeval));
+ memmove(&last, &now, sizeof(struct timeval));
break;
}
#endif
@@ -380,16 +380,9 @@ void *pluginsd_worker_thread(void *arg)
// get the return code
int code = mypclose(fp, cd->pid);
-
- if(netdata_exit) {
- cd->pid = 0;
- cd->enabled = 0;
- cd->obsolete = 1;
- pthread_exit(NULL);
- return NULL;
- }
-
- if(code != 0) {
+
+ if(unlikely(netdata_exit)) break;
+ else if(code != 0) {
// the plugin reports failure
if(likely(!cd->successful_collections)) {
@@ -430,10 +423,11 @@ void *pluginsd_worker_thread(void *arg)
}
cd->pid = 0;
- if(unlikely(!cd->enabled))
- break;
+ if(unlikely(!cd->enabled)) break;
}
+ info("PLUGINSD: '%s' thread exiting", cd->fullfilename);
+
cd->obsolete = 1;
pthread_exit(NULL);
return NULL;
@@ -462,7 +456,7 @@ void *pluginsd_main(void *ptr) {
if(scan_frequency < 1) scan_frequency = 1;
- while(likely(1)) {
+ for(;;) {
if(unlikely(netdata_exit)) break;
dir = opendir(dir_name);
@@ -542,6 +536,8 @@ void *pluginsd_main(void *ptr) {
sleep((unsigned int) scan_frequency);
}
+ info("PLUGINS.D thread exiting");
+
pthread_exit(NULL);
return NULL;
}