diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2016-11-23 15:49:14 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2016-11-23 15:49:14 +0000 |
commit | 68141d9dac0c08e51d257feef16a79086dd8a2df (patch) | |
tree | f4a0f5d31ed2194b5991130754b297b9c8c076e6 /src/plugins_d.c | |
parent | Release v. 1.3.0+dfsg-1 to Unstable (diff) | |
parent | New upstream version 1.4.0+dfsg (diff) | |
download | netdata-68141d9dac0c08e51d257feef16a79086dd8a2df.tar.xz netdata-68141d9dac0c08e51d257feef16a79086dd8a2df.zip |
Merge tag 'upstream/1.4.0+dfsg'
Upstream version 1.4.0+dfsg
Diffstat (limited to 'src/plugins_d.c')
-rw-r--r-- | src/plugins_d.c | 26 |
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; } |