static_threads.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_STATIC_THREADS_H
  3. #define NETDATA_STATIC_THREADS_H
  4. #include "common.h"
  5. struct netdata_static_thread {
  6. // the name of the thread as it should appear in the logs
  7. char *name;
  8. // the section of netdata.conf to check if this is enabled or not
  9. char *config_section;
  10. // the name of the config option to check if it is true or false
  11. char *config_name;
  12. // the current status of the thread
  13. volatile sig_atomic_t enabled;
  14. // internal use, to maintain a pointer to the created thread
  15. netdata_thread_t *thread;
  16. // an initialization function to run before spawning the thread
  17. void (*init_routine) (void);
  18. // the threaded worker
  19. void *(*start_routine) (void *);
  20. };
  21. #define NETDATA_MAIN_THREAD_RUNNING CONFIG_BOOLEAN_YES
  22. #define NETDATA_MAIN_THREAD_EXITING (CONFIG_BOOLEAN_YES + 1)
  23. #define NETDATA_MAIN_THREAD_EXITED CONFIG_BOOLEAN_NO
  24. extern const struct netdata_static_thread static_threads_common[];
  25. extern const struct netdata_static_thread static_threads_linux[];
  26. extern const struct netdata_static_thread static_threads_freebsd[];
  27. extern const struct netdata_static_thread static_threads_macos[];
  28. struct netdata_static_thread *
  29. static_threads_concat(const struct netdata_static_thread *lhs,
  30. const struct netdata_static_thread *rhs);
  31. struct netdata_static_thread *static_threads_get();
  32. #endif /* NETDATA_STATIC_THREADS_H */