From: Sebastian B. <sb...@us...> - 2013-12-24 09:24:36
|
Update of /cvsroot/simplemail/simplemail/gtk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32644/gtk Modified Files: subthreads.c Log Message: Made the waiting for the signal a loop like it is recommended. Index: subthreads.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/gtk/subthreads.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- subthreads.c 24 Dec 2013 09:24:16 -0000 1.48 +++ subthreads.c 24 Dec 2013 09:24:33 -0000 1.49 @@ -38,6 +38,7 @@ static GCond *thread_cond; static GMutex *thread_mutex; +static int thread_parent_can_continue; static int input_added; @@ -134,6 +135,7 @@ int thread_parent_task_can_contiue(void) { g_mutex_lock(thread_mutex); + thread_parent_can_continue = 1; g_cond_signal(thread_cond); g_mutex_unlock(thread_mutex); return 1; @@ -230,7 +232,9 @@ if ((g_thread_create(thread_add_entry,&tad,TRUE,NULL))) { g_mutex_lock(thread_mutex); - g_cond_wait(thread_cond,thread_mutex); + while (!thread_parent_can_continue) + g_cond_wait(thread_cond,thread_mutex); + thread_parent_can_continue = 0; g_mutex_unlock(thread_mutex); return t; } |