diff --git a/src/backend/threads.c b/src/backend/threads.c index 6b949265b..b81e8d233 100644 --- a/src/backend/threads.c +++ b/src/backend/threads.c @@ -108,6 +108,8 @@ thread_loop (void* thread) /* move error state to data the other thread will it pick up from there */ t->arguments = (void*)lumiera_error (); t->state = LUMIERA_THREADSTATE_ZOMBIE; + ERROR_IF (t->arguments, threads, "joinable thread ended with error %s", (char*)t->arguments); + LUMIERA_CONDITION_SIGNAL; LUMIERA_CONDITION_WAIT (t->state == LUMIERA_THREADSTATE_JOINED); INFO (threads, "Thread joined"); @@ -342,6 +344,8 @@ lumiera_thread_join (LumieraThread thread) { LUMIERA_CONDITION_WAIT (thread->state == LUMIERA_THREADSTATE_ZOMBIE); ret = (lumiera_err)thread->arguments; + ERROR_IF (ret, threads, "thread joined with error %s", ret); + thread->state = LUMIERA_THREADSTATE_JOINED; LUMIERA_CONDITION_SIGNAL; /* kiss it a last goodbye */ }