From: Sebastian B. <sb...@us...> - 2013-12-24 09:24:18
|
Update of /cvsroot/simplemail/simplemail/gtk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32622/gtk Modified Files: subthreads.c Log Message: Assign the thread pointer in the thread and not outside the thread to avoid races. Index: subthreads.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/gtk/subthreads.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- subthreads.c 24 Dec 2013 09:23:58 -0000 1.47 +++ subthreads.c 24 Dec 2013 09:24:16 -0000 1.48 @@ -196,6 +196,7 @@ struct thread_s *t = tad->thread; /* TODO: Catch errors and inform parent task */ + t->thread = g_thread_self(); t->context = g_main_context_new(); t->main_loop = g_main_loop_new(t->context, FALSE); @@ -226,7 +227,7 @@ list_insert_tail(&thread_list, &t->node); g_mutex_unlock(thread_list_mutex); - if ((t->thread = g_thread_create(thread_add_entry,&tad,TRUE,NULL))) + if ((g_thread_create(thread_add_entry,&tad,TRUE,NULL))) { g_mutex_lock(thread_mutex); g_cond_wait(thread_cond,thread_mutex); |