summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore/ecore_thread.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-08-07 03:47:14 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-08-07 03:47:14 +0000
commit83872cb113eb3285d593c5a8ff49d6f089a8e21b (patch)
tree3e7a3af3c135b71e0de6dd1580a1171a40fc847d /legacy/ecore/src/lib/ecore/ecore_thread.c
parent2cefdbcec6dd138f9fa8b7f651e74eb886a71c90 (diff)
ecore: fix shutdown to use a different mutex for the list of running thread.
SVN revision: 74953
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore_thread.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore_thread.c b/legacy/ecore/src/lib/ecore/ecore_thread.c
index b91d0fef16..275be5d510 100644
--- a/legacy/ecore/src/lib/ecore/ecore_thread.c
+++ b/legacy/ecore/src/lib/ecore/ecore_thread.c
@@ -221,6 +221,7 @@ static Eina_List *_ecore_running_job = NULL;
221static Eina_List *_ecore_pending_job_threads = NULL; 221static Eina_List *_ecore_pending_job_threads = NULL;
222static Eina_List *_ecore_pending_job_threads_feedback = NULL; 222static Eina_List *_ecore_pending_job_threads_feedback = NULL;
223static LK(_ecore_pending_job_threads_mutex); 223static LK(_ecore_pending_job_threads_mutex);
224static LK(_ecore_running_job_mutex);
224 225
225static Eina_Hash *_ecore_thread_global_hash = NULL; 226static Eina_Hash *_ecore_thread_global_hash = NULL;
226static LRWK(_ecore_thread_global_hash_lock); 227static LRWK(_ecore_thread_global_hash_lock);
@@ -414,8 +415,11 @@ _ecore_short_job(PH(thread))
414 work = eina_list_data_get(_ecore_pending_job_threads); 415 work = eina_list_data_get(_ecore_pending_job_threads);
415 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, 416 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads,
416 _ecore_pending_job_threads); 417 _ecore_pending_job_threads);
417 _ecore_running_job = eina_list_append(_ecore_running_job, work);
418 LKU(_ecore_pending_job_threads_mutex); 418 LKU(_ecore_pending_job_threads_mutex);
419
420 LKL(_ecore_running_job_mutex);
421 _ecore_running_job = eina_list_append(_ecore_running_job, work);
422 LKU(_ecore_running_job_mutex);
419 423
420 LKL(work->cancel_mutex); 424 LKL(work->cancel_mutex);
421 cancel = work->cancel; 425 cancel = work->cancel;
@@ -424,9 +428,9 @@ _ecore_short_job(PH(thread))
424 if (!cancel) 428 if (!cancel)
425 work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work); 429 work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work);
426 430
427 LKL(_ecore_pending_job_threads_mutex); 431 LKL(_ecore_running_job_mutex);
428 _ecore_running_job = eina_list_remove(_ecore_running_job, work); 432 _ecore_running_job = eina_list_remove(_ecore_running_job, work);
429 LKU(_ecore_pending_job_threads_mutex); 433 LKU(_ecore_running_job_mutex);
430 434
431 if (work->reschedule) 435 if (work->reschedule)
432 { 436 {
@@ -459,8 +463,10 @@ _ecore_feedback_job(PH(thread))
459 work = eina_list_data_get(_ecore_pending_job_threads_feedback); 463 work = eina_list_data_get(_ecore_pending_job_threads_feedback);
460 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, 464 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback,
461 _ecore_pending_job_threads_feedback); 465 _ecore_pending_job_threads_feedback);
462 _ecore_running_job = eina_list_append(_ecore_running_job, work);
463 LKU(_ecore_pending_job_threads_mutex); 466 LKU(_ecore_pending_job_threads_mutex);
467 LKL(_ecore_running_job_mutex);
468 _ecore_running_job = eina_list_append(_ecore_running_job, work);
469 LKU(_ecore_running_job_mutex);
464 470
465 LKL(work->cancel_mutex); 471 LKL(work->cancel_mutex);
466 cancel = work->cancel; 472 cancel = work->cancel;
@@ -469,9 +475,9 @@ _ecore_feedback_job(PH(thread))
469 if (!cancel) 475 if (!cancel)
470 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work); 476 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
471 477
472 LKL(_ecore_pending_job_threads_mutex); 478 LKL(_ecore_running_job_mutex);
473 _ecore_running_job = eina_list_remove(_ecore_running_job, work); 479 _ecore_running_job = eina_list_remove(_ecore_running_job, work);
474 LKU(_ecore_pending_job_threads_mutex); 480 LKU(_ecore_running_job_mutex);
475 481
476 if (work->reschedule) 482 if (work->reschedule)
477 { 483 {
@@ -594,6 +600,7 @@ _ecore_thread_init(void)
594 LKI(_ecore_pending_job_threads_mutex); 600 LKI(_ecore_pending_job_threads_mutex);
595 LRWKI(_ecore_thread_global_hash_lock); 601 LRWKI(_ecore_thread_global_hash_lock);
596 LKI(_ecore_thread_global_hash_mutex); 602 LKI(_ecore_thread_global_hash_mutex);
603 LKI(_ecore_running_job_mutex);
597 CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex); 604 CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex);
598#endif 605#endif
599} 606}
@@ -624,10 +631,13 @@ _ecore_thread_shutdown(void)
624 free(work); 631 free(work);
625 } 632 }
626 633
634 LKU(_ecore_pending_job_threads_mutex);
635 LKL(_ecore_running_job_mutex);
636
627 EINA_LIST_FOREACH(_ecore_running_job, l, work) 637 EINA_LIST_FOREACH(_ecore_running_job, l, work)
628 ecore_thread_cancel((Ecore_Thread*) work); 638 ecore_thread_cancel((Ecore_Thread*) work);
629 639
630 LKU(_ecore_pending_job_threads_mutex); 640 LKU(_ecore_running_job_mutex);
631 641
632 do 642 do
633 { 643 {
@@ -663,6 +673,7 @@ _ecore_thread_shutdown(void)
663 LKD(_ecore_pending_job_threads_mutex); 673 LKD(_ecore_pending_job_threads_mutex);
664 LRWKD(_ecore_thread_global_hash_lock); 674 LRWKD(_ecore_thread_global_hash_lock);
665 LKD(_ecore_thread_global_hash_mutex); 675 LKD(_ecore_thread_global_hash_mutex);
676 LKD(_ecore_running_job_mutex);
666 CDD(_ecore_thread_global_hash_cond); 677 CDD(_ecore_thread_global_hash_cond);
667#endif 678#endif
668} 679}