diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2023-08-21 11:19:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 11:19:32 +0300 |
commit | b090c9f80b64005003294d4b8390bd9b6cf0aecf (patch) | |
tree | 43f4a034eb0badb905cc7f98b5c6f78e22ff3ae1 /libnetdata | |
parent | c26af4455223d7d0f8964e408d4ca02e78b710df (diff) |
Fix static build SSL (#15842)
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/threads/threads.c | 21 | ||||
-rw-r--r-- | libnetdata/threads/threads.h | 1 |
2 files changed, 18 insertions, 4 deletions
diff --git a/libnetdata/threads/threads.c b/libnetdata/threads/threads.c index adce0463c0..ae3c7106d9 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); diff --git a/libnetdata/threads/threads.h b/libnetdata/threads/threads.h index 39b669683d..acb4e6ba26 100644 --- a/libnetdata/threads/threads.h +++ b/libnetdata/threads/threads.h @@ -59,6 +59,7 @@ int netdata_thread_tag_exists(void); size_t netdata_threads_init(void); void netdata_threads_init_after_fork(size_t stacksize); +void netdata_threads_init_for_external_plugins(size_t stacksize); int netdata_thread_create(netdata_thread_t *thread, const char *tag, NETDATA_THREAD_OPTIONS options, void *(*start_routine) (void *), void *arg); |