summaryrefslogtreecommitdiffstats
path: root/daemon/static_threads.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:42 +0000
commit112b5b91647c3dea45cc1c9bc364df526c8012f1 (patch)
tree450af925135ec664c4310a1eb28b69481094ee2a /daemon/static_threads.h
parentReleasing debian version 1.32.1-2. (diff)
downloadnetdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.tar.xz
netdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.zip
Merging upstream version 1.33.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/static_threads.h')
-rw-r--r--daemon/static_threads.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/daemon/static_threads.h b/daemon/static_threads.h
new file mode 100644
index 000000000..dac615e76
--- /dev/null
+++ b/daemon/static_threads.h
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_STATIC_THREADS_H
+#define NETDATA_STATIC_THREADS_H
+
+#include "common.h"
+
+struct netdata_static_thread {
+ // the name of the thread as it should appear in the logs
+ char *name;
+
+ // the section of netdata.conf to check if this is enabled or not
+ char *config_section;
+
+ // the name of the config option to check if it is true or false
+ char *config_name;
+
+ // the current status of the thread
+ volatile sig_atomic_t enabled;
+
+ // internal use, to maintain a pointer to the created thread
+ netdata_thread_t *thread;
+
+ // an initialization function to run before spawning the thread
+ void (*init_routine) (void);
+
+ // the threaded worker
+ void *(*start_routine) (void *);
+};
+
+#define NETDATA_MAIN_THREAD_RUNNING CONFIG_BOOLEAN_YES
+#define NETDATA_MAIN_THREAD_EXITING (CONFIG_BOOLEAN_YES + 1)
+#define NETDATA_MAIN_THREAD_EXITED CONFIG_BOOLEAN_NO
+
+extern const struct netdata_static_thread static_threads_common[];
+extern const struct netdata_static_thread static_threads_linux[];
+extern const struct netdata_static_thread static_threads_freebsd[];
+extern const struct netdata_static_thread static_threads_macos[];
+
+struct netdata_static_thread *
+static_threads_concat(const struct netdata_static_thread *lhs,
+ const struct netdata_static_thread *rhs);
+
+struct netdata_static_thread *static_threads_get();
+
+#endif /* NETDATA_STATIC_THREADS_H */