summaryrefslogtreecommitdiffstats
path: root/libnetdata/threads/threads.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-30 18:47:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-30 18:47:05 +0000
commit97e01009d69b8fbebfebf68f51e3d126d0ed43fc (patch)
tree02e8b836c3a9d89806f3e67d4a5fe9f52dbb0061 /libnetdata/threads/threads.h
parentReleasing debian version 1.36.1-1. (diff)
downloadnetdata-97e01009d69b8fbebfebf68f51e3d126d0ed43fc.tar.xz
netdata-97e01009d69b8fbebfebf68f51e3d126d0ed43fc.zip
Merging upstream version 1.37.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/threads/threads.h')
-rw-r--r--libnetdata/threads/threads.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/libnetdata/threads/threads.h b/libnetdata/threads/threads.h
index e7d79d328..ccc18aff0 100644
--- a/libnetdata/threads/threads.h
+++ b/libnetdata/threads/threads.h
@@ -5,7 +5,7 @@
#include "../libnetdata.h"
-extern pid_t gettid(void);
+pid_t gettid(void);
typedef enum {
NETDATA_THREAD_OPTION_DEFAULT = 0 << 0,
@@ -21,20 +21,27 @@ typedef enum {
typedef pthread_t netdata_thread_t;
#define NETDATA_THREAD_TAG_MAX 100
-extern const char *netdata_thread_tag(void);
-extern int netdata_thread_tag_exists(void);
+const char *netdata_thread_tag(void);
+int netdata_thread_tag_exists(void);
-extern size_t netdata_threads_init(void);
-extern void netdata_threads_init_after_fork(size_t stacksize);
+size_t netdata_threads_init(void);
+void netdata_threads_init_after_fork(size_t stacksize);
-extern int netdata_thread_create(netdata_thread_t *thread, const char *tag, NETDATA_THREAD_OPTIONS options, void *(*start_routine) (void *), void *arg);
-extern int netdata_thread_cancel(netdata_thread_t thread);
-extern int netdata_thread_join(netdata_thread_t thread, void **retval);
-extern int netdata_thread_detach(pthread_t thread);
+int netdata_thread_create(netdata_thread_t *thread, const char *tag, NETDATA_THREAD_OPTIONS options, void *(*start_routine) (void *), void *arg);
+
+#ifdef NETDATA_INTERNAL_CHECKS
+#define netdata_thread_cancel(thread) netdata_thread_cancel_with_trace(thread, __LINE__, __FILE__, __FUNCTION__)
+int netdata_thread_cancel_with_trace(netdata_thread_t thread, int line, const char *file, const char *function);
+#else
+int netdata_thread_cancel(netdata_thread_t thread);
+#endif
+
+int netdata_thread_join(netdata_thread_t thread, void **retval);
+int netdata_thread_detach(pthread_t thread);
#define NETDATA_THREAD_NAME_MAX 15
-extern void uv_thread_set_name_np(uv_thread_t ut, const char* name);
-extern void os_thread_get_current_name_np(char threadname[NETDATA_THREAD_NAME_MAX + 1]);
+void uv_thread_set_name_np(uv_thread_t ut, const char* name);
+void os_thread_get_current_name_np(char threadname[NETDATA_THREAD_NAME_MAX + 1]);
#define netdata_thread_self pthread_self
#define netdata_thread_testcancel pthread_testcancel