diff options
Diffstat (limited to 'src/collectors/ebpf.plugin/ebpf.c')
-rw-r--r-- | src/collectors/ebpf.plugin/ebpf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/collectors/ebpf.plugin/ebpf.c b/src/collectors/ebpf.plugin/ebpf.c index 5cbcd19abf..675ba68328 100644 --- a/src/collectors/ebpf.plugin/ebpf.c +++ b/src/collectors/ebpf.plugin/ebpf.c @@ -943,6 +943,13 @@ void ebpf_stop_threads(int sig) } pthread_mutex_unlock(&ebpf_exit_cleanup); + for (i = 0; ebpf_modules[i].info.thread_name != NULL; i++) { + if (ebpf_threads[i].thread) + netdata_thread_join(*ebpf_threads[i].thread, NULL); + } + + ebpf_plugin_exit = true; + pthread_mutex_lock(&mutex_cgroup_shm); netdata_thread_cancel(*cgroup_integration_thread.thread); #ifdef NETDATA_DEV_MODE @@ -950,8 +957,6 @@ void ebpf_stop_threads(int sig) #endif pthread_mutex_unlock(&mutex_cgroup_shm); - ebpf_plugin_exit = true; - ebpf_check_before2go(); pthread_mutex_lock(&ebpf_exit_cleanup); @@ -4022,7 +4027,7 @@ int main(int argc, char **argv) st->thread = mallocz(sizeof(netdata_thread_t)); em->enabled = NETDATA_THREAD_EBPF_RUNNING; em->lifetime = EBPF_NON_FUNCTION_LIFE_TIME; - netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_DEFAULT, st->start_routine, em); + netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_JOINABLE, st->start_routine, em); } else { em->lifetime = EBPF_DEFAULT_LIFETIME; } |