diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 08:57:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 08:57:43 +0000 |
commit | 42ad44d1fea072d23f2e0067bca4ba6bc0b2a523 (patch) | |
tree | b1c1459c6914f1d4c5b123b601b9dbecb049360c /libnetdata/threads/threads.c | |
parent | Adding upstream version 1.42.1. (diff) | |
download | netdata-42ad44d1fea072d23f2e0067bca4ba6bc0b2a523.tar.xz netdata-42ad44d1fea072d23f2e0067bca4ba6bc0b2a523.zip |
Adding upstream version 1.42.2.upstream/1.42.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | libnetdata/threads/threads.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libnetdata/threads/threads.c b/libnetdata/threads/threads.c index adce0463c..ae3c7106d 100644 --- a/libnetdata/threads/threads.c +++ b/libnetdata/threads/threads.c @@ -123,10 +123,12 @@ size_t netdata_threads_init(void) { // -------------------------------------------------------------------- // get the required stack size of the threads of netdata - netdata_threads_attr = callocz(1, sizeof(pthread_attr_t)); - i = pthread_attr_init(netdata_threads_attr); - if(i != 0) - fatal("pthread_attr_init() failed with code %d.", i); + if(!netdata_threads_attr) { + netdata_threads_attr = callocz(1, sizeof(pthread_attr_t)); + i = pthread_attr_init(netdata_threads_attr); + if (i != 0) + fatal("pthread_attr_init() failed with code %d.", i); + } size_t stacksize = 0; i = pthread_attr_getstacksize(netdata_threads_attr, &stacksize); @@ -159,6 +161,17 @@ void netdata_threads_init_after_fork(size_t stacksize) { } // ---------------------------------------------------------------------------- +// threads init for external plugins + +void netdata_threads_init_for_external_plugins(size_t stacksize) { + size_t default_stacksize = netdata_threads_init(); + if(default_stacksize < 1 * 1024 * 1024) + default_stacksize = 1 * 1024 * 1024; + + netdata_threads_init_after_fork(stacksize ? stacksize : default_stacksize); +} + +// ---------------------------------------------------------------------------- // netdata_thread_create void rrdset_thread_rda_free(void); |