]> arthur.barton.de Git - netdata.git/blobdiff - src/main.c
enable cgroups only on Linux; #1632
[netdata.git] / src / main.c
index 1dcd3f7841469836bc0f49d6dfd555d92661f817..7232bdb1d0edcf52e3d75ed49bac73b84e22f55a 100644 (file)
@@ -46,8 +46,8 @@ struct netdata_static_thread static_threads[] = {
 #else
     {"proc",               "plugins",   "proc",       1, NULL, NULL, proc_main},
     {"diskspace",          "plugins",   "diskspace",  1, NULL, NULL, proc_diskspace_main},
-#endif /* __FreeBSD__, __APPLE__*/
     {"cgroups",            "plugins",   "cgroups",    1, NULL, NULL, cgroups_main},
+#endif /* __FreeBSD__, __APPLE__*/
     {"check",              "plugins",   "checks",     0, NULL, NULL, checks_main},
     {"backends",            NULL,       NULL,         1, NULL, NULL, backends_main},
     {"health",              NULL,       NULL,         1, NULL, NULL, health_main},
@@ -161,17 +161,19 @@ void kill_childs()
         pthread_cancel(w->thread);
         // it is detached
         // pthread_join(w->thread, NULL);
+
+        w->obsolete = 1;
     }
 
     int i;
     for (i = 0; static_threads[i].name != NULL ; i++) {
-        if(static_threads[i].enabled && static_threads[i].thread) {
+        if(static_threads[i].enabled) {
             info("Stopping %s thread", static_threads[i].name);
             pthread_cancel(*static_threads[i].thread);
             // it is detached
             // pthread_join(*static_threads[i].thread, NULL);
 
-            static_threads[i].thread = NULL;
+            static_threads[i].enabled = 0;
         }
     }
 
@@ -179,19 +181,15 @@ void kill_childs()
         info("Killing tc-qos-helper process %d", tc_child_pid);
         if(killpid(tc_child_pid, SIGTERM) != -1)
             waitid(P_PID, (id_t) tc_child_pid, &info, WEXITED);
+
+        tc_child_pid = 0;
     }
-    tc_child_pid = 0;
 
     struct plugind *cd;
     for(cd = pluginsd_root ; cd ; cd = cd->next) {
         if(cd->enabled && !cd->obsolete) {
-            if(cd->thread != (pthread_t)NULL) {
-                info("Stopping %s plugin thread", cd->id);
-                pthread_cancel(cd->thread);
-                // they are detached
-                // pthread_join(cd->thread, NULL);
-                cd->thread = (pthread_t)NULL;
-            }
+            info("Stopping %s plugin thread", cd->id);
+            pthread_cancel(cd->thread);
 
             if(cd->pid) {
                 info("killing %s plugin child process pid %d", cd->id, cd->pid);