* ecore: turn on and off eina threads support when needed.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 13 Oct 2010 16:44:15 +0000 (16:44 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 13 Oct 2010 16:44:15 +0000 (16:44 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@53364 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore/ecore_thread.c

index e24e4c9..1527f75 100644 (file)
@@ -124,6 +124,8 @@ _ecore_thread_end(Ecore_Pthread_Data *pth)
    if (pthread_join(pth->thread, (void **) &p) != 0)
      return ;
 
+   eina_threads_shutdown();
+
    _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth);
 
    ecore_event_add(ECORE_THREAD_PIPE_DEL, pth->p, _ecore_thread_pipe_free, NULL);
@@ -479,9 +481,13 @@ ecore_thread_run(Ecore_Cb func_blocking,
    pth->p = ecore_pipe_add(_ecore_thread_handler, NULL);
    if (!pth->p) goto on_error;
 
+   eina_threads_init();
+
    if (pthread_create(&pth->thread, NULL, (void *) _ecore_thread_worker, pth) == 0)
       return (Ecore_Thread *) work;
 
+   eina_threads_shutdown();
+
  on_error:
    if (pth)
      {
@@ -562,6 +568,8 @@ ecore_thread_cancel(Ecore_Thread *thread)
                       work->func_cancel((void *) work->data);
                     free(work);
 
+                    eina_threads_shutdown();
+
                     return EINA_TRUE;
                  }
             }
@@ -578,6 +586,8 @@ ecore_thread_cancel(Ecore_Thread *thread)
                       work->func_cancel((void *) work->data);
                     free(work);
 
+                    eina_threads_shutdown();
+
                     return EINA_TRUE;
                  }
             }
@@ -698,9 +708,13 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Heavy_Cb func_heavy,
    pth->p = ecore_pipe_add(_ecore_thread_handler, NULL);
    if (!pth->p) goto on_error;
 
+   eina_threads_init();
+
    if (pthread_create(&pth->thread, NULL, (void *) _ecore_thread_worker, pth) == 0)
       return (Ecore_Thread *) worker;
 
+   eina_threads_shutdown();
+
  on_error:
    if (pth)
      {