raster pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=19116d188a44330a946cd22ba2032c3d0f56f465

commit 19116d188a44330a946cd22ba2032c3d0f56f465
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Sat Feb 15 14:41:13 2014 +0900

    examples - threads - fix nitpick on still running threads on shutdown
    
    this fixes T955
---
 src/examples/efl_thread_6.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/examples/efl_thread_6.c b/src/examples/efl_thread_6.c
index 1bc9f00..f9d9c8d 100644
--- a/src/examples/efl_thread_6.c
+++ b/src/examples/efl_thread_6.c
@@ -3,6 +3,7 @@
 #include <Elementary.h>
 
 static Evas_Object *win = NULL;
+static Eina_List *threads;
 
 struct info
 {
@@ -82,6 +83,7 @@ th_end(void *data, Ecore_Thread *th)
    evas_object_show(inf->obj);
    free(inf->pix);
    free(inf);
+   threads = eina_list_remove(threads, th);
 }
 
 static void // if the thread is cancelled - free pix, keep obj tho
@@ -121,6 +123,7 @@ EAPI_MAIN int
 elm_main(int argc, char **argv)
 {
    Evas_Object *o;
+   Ecore_Thread *th;
    int i;
 
    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
@@ -143,7 +146,8 @@ elm_main(int argc, char **argv)
              evas_object_resize(o, 256, 256);
              inf->obj = o;
              inf->pix = malloc(256 * 256 * sizeof(int));
-             ecore_thread_run(th_do, th_end, th_cancel, inf);
+             th = ecore_thread_run(th_do, th_end, th_cancel, inf);
+             threads = eina_list_append(threads, th);
              // bonus - slide the objects around all the time with an
              // animator that ticks off every frame.
              ecore_animator_add(anim, o);
@@ -154,6 +158,10 @@ elm_main(int argc, char **argv)
    evas_object_show(win);
 
    elm_run();
+
+   // if some threads are still running - cancel them
+   EINA_LIST_FREE(threads, th) ecore_thread_cancel(th);
+   
    elm_shutdown();
 
    return 0;

-- 


Reply via email to