From: Sebastian B. <sb...@us...> - 2013-12-24 09:15:23
|
Update of /cvsroot/simplemail/simplemail/gtk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31481/gtk Modified Files: subthreads.c Log Message: Cleanup the threads one by one by aborting and joining them. Index: subthreads.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/gtk/subthreads.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- subthreads.c 24 Dec 2013 09:15:06 -0000 1.40 +++ subthreads.c 24 Dec 2013 09:15:21 -0000 1.41 @@ -101,14 +101,22 @@ { struct thread_s *t; - g_mutex_lock(thread_list_mutex); - t = (struct thread_s*)list_first(&thread_list); - while (t) + while (1) { - thread_abort(t); - t = (struct thread_s*)node_next(&t->node); + g_mutex_lock(thread_list_mutex); + if ((t = (struct thread_s*)list_first(&thread_list))) + { + GThread *gt; + gt = t->thread; + thread_abort(t); + g_mutex_unlock(thread_list_mutex); + g_thread_join(gt); + } else + { + g_mutex_unlock(thread_list_mutex); + break; + } } - g_mutex_unlock(thread_list_mutex); g_main_loop_unref(main_thread.main_loop); g_main_context_unref(main_thread.context); |