Log the error passing when joining threads

This commit is contained in:
Christian Thaeter 2010-01-30 06:43:38 +01:00
parent 6aacf490a3
commit dc5ae73626

View file

@ -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 */
}