summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/threads/threads.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libnetdata/threads/threads.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libnetdata/threads/threads.c b/src/libnetdata/threads/threads.c
index 0e12d173e..36c63f4e0 100644
--- a/src/libnetdata/threads/threads.c
+++ b/src/libnetdata/threads/threads.c
@@ -418,12 +418,14 @@ bool nd_thread_signaled_to_cancel(void) {
// ----------------------------------------------------------------------------
// nd_thread_join
-void nd_thread_join(ND_THREAD *nti) {
- if(!nti) return;
+int nd_thread_join(ND_THREAD *nti) {
+ if(!nti)
+ return ESRCH;
int ret = pthread_join(nti->thread, NULL);
- if(ret != 0)
- nd_log(NDLS_DAEMON, NDLP_WARNING, "cannot join thread. pthread_join() failed with code %d.", ret);
+ if(ret != 0) {
+ nd_log(NDLS_DAEMON, NDLP_WARNING, "cannot join thread. pthread_join() failed with code %d. (tag=%s)", ret, nti->tag);
+ }
else {
nd_thread_status_set(nti, NETDATA_THREAD_STATUS_JOINED);
@@ -434,4 +436,6 @@ void nd_thread_join(ND_THREAD *nti) {
freez(nti);
}
+
+ return ret;
}