* ecore: remove thread from the correct list.

SVN revision: 53029
This commit is contained in:
Cedric BAIL 2010-10-04 15:24:34 +00:00
parent 21a7dde012
commit 05262d2120
1 changed files with 38 additions and 19 deletions

View File

@ -507,12 +507,15 @@ ecore_thread_cancel(Ecore_Thread *thread)
if (!work) if (!work)
return EINA_TRUE; return EINA_TRUE;
if (work->cancel)
return EINA_FALSE;
pthread_mutex_lock(&_ecore_pending_job_threads_mutex); pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
if ((have_main_loop_thread) && if ((have_main_loop_thread) &&
(pthread_equal(main_loop_thread, pthread_self()))) (pthread_equal(main_loop_thread, pthread_self())))
{ {
if (!work->feedback_run)
EINA_LIST_FOREACH(_ecore_pending_job_threads, l, work) EINA_LIST_FOREACH(_ecore_pending_job_threads, l, work)
{ {
if ((void *) work == (void *) thread) if ((void *) work == (void *) thread)
@ -525,6 +528,22 @@ ecore_thread_cancel(Ecore_Thread *thread)
work->func_cancel((void *) work->data); work->func_cancel((void *) work->data);
free(work); free(work);
return EINA_TRUE;
}
}
else
EINA_LIST_FOREACH(_ecore_pending_job_threads_feedback, l, work)
{
if ((void *) work == (void *) thread)
{
_ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, l);
pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
if (work->func_cancel)
work->func_cancel((void *) work->data);
free(work);
return EINA_TRUE; return EINA_TRUE;
} }
} }