summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--NEWS2
-rw-r--r--src/lib/ecore/ecore_thread.c156
3 files changed, 84 insertions, 75 deletions
diff --git a/ChangeLog b/ChangeLog
index 4109be5e7c..58d181bad3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
5 Eina_Chained_Mempool. 5 Eina_Chained_Mempool.
6 * Eet: replace Eina_Lock by Eina_Spinlock in Eet_Dictionnary. 6 * Eet: replace Eina_Lock by Eina_Spinlock in Eet_Dictionnary.
7 * Evas: replace Eina_Lock by Eina_Spinlock in Evas_ScaleCache, Evas_Async_Events and Image_Entry. 7 * Evas: replace Eina_Lock by Eina_Spinlock in Evas_ScaleCache, Evas_Async_Events and Image_Entry.
8 * Ecore: use Eina_Spinlock for Ecore_Thread.
8 9
92013-10-10 Carsten Haitzler (The Rasterman) 102013-10-10 Carsten Haitzler (The Rasterman)
10 11
diff --git a/NEWS b/NEWS
index f8895cc595..19c4350ed3 100644
--- a/NEWS
+++ b/NEWS
@@ -225,6 +225,8 @@ Improvements:
225 - Use mmap/munmap for image data allocation on system that have mmap. 225 - Use mmap/munmap for image data allocation on system that have mmap.
226 - Add iterator for walking child of smart objects, table and a box. 226 - Add iterator for walking child of smart objects, table and a box.
227 - Use Eina_Spinlock for Evas_ScaleCache, Evas_Async_Events and Image_Entry. 227 - Use Eina_Spinlock for Evas_ScaleCache, Evas_Async_Events and Image_Entry.
228 * Ecore:
229 - Use Eina_Spinlock for Ecore_Thread.
228 * Ecore_Con: 230 * Ecore_Con:
229 - Rebase dns.c against upstream 231 - Rebase dns.c against upstream
230 - URL support now dynamically loads libcurl at runtime via eina_module. 232 - URL support now dynamically loads libcurl at runtime via eina_module.
diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c
index ee13c45043..fed5b3353b 100644
--- a/src/lib/ecore/ecore_thread.c
+++ b/src/lib/ecore/ecore_thread.c
@@ -21,6 +21,12 @@
21# define LKL(x) eina_lock_take(&(x)) 21# define LKL(x) eina_lock_take(&(x))
22# define LKU(x) eina_lock_release(&(x)) 22# define LKU(x) eina_lock_release(&(x))
23 23
24# define SLK(x) Eina_Spinlock x
25# define SLKI(x) eina_spinlock_new(&(x))
26# define SLKD(x) eina_spinlock_free(&(x))
27# define SLKL(x) eina_spinlock_take(&(x))
28# define SLKU(x) eina_spinlock_release(&(x))
29
24# define CD(x) Eina_Condition x 30# define CD(x) Eina_Condition x
25# define CDI(x, m) eina_condition_new(&(x), &(m)) 31# define CDI(x, m) eina_condition_new(&(x), &(m))
26# define CDD(x) eina_condition_free(&(x)) 32# define CDD(x) eina_condition_free(&(x))
@@ -92,7 +98,7 @@ struct _Ecore_Pthread_Worker
92 98
93 int cancel; 99 int cancel;
94 100
95 LK(cancel_mutex); 101 SLK(cancel_mutex);
96 102
97 Eina_Bool message_run : 1; 103 Eina_Bool message_run : 1;
98 Eina_Bool feedback_run : 1; 104 Eina_Bool feedback_run : 1;
@@ -135,8 +141,8 @@ static int _ecore_thread_count = 0;
135static Eina_List *_ecore_running_job = NULL; 141static Eina_List *_ecore_running_job = NULL;
136static Eina_List *_ecore_pending_job_threads = NULL; 142static Eina_List *_ecore_pending_job_threads = NULL;
137static Eina_List *_ecore_pending_job_threads_feedback = NULL; 143static Eina_List *_ecore_pending_job_threads_feedback = NULL;
138static LK(_ecore_pending_job_threads_mutex); 144static SLK(_ecore_pending_job_threads_mutex);
139static LK(_ecore_running_job_mutex); 145static SLK(_ecore_running_job_mutex);
140 146
141static Eina_Hash *_ecore_thread_global_hash = NULL; 147static Eina_Hash *_ecore_thread_global_hash = NULL;
142static LRWK(_ecore_thread_global_hash_lock); 148static LRWK(_ecore_thread_global_hash_lock);
@@ -170,7 +176,7 @@ static PH(get_main_loop_thread) (void)
170static void 176static void
171_ecore_thread_worker_free(Ecore_Pthread_Worker *worker) 177_ecore_thread_worker_free(Ecore_Pthread_Worker *worker)
172{ 178{
173 LKD(worker->cancel_mutex); 179 SLKD(worker->cancel_mutex);
174 CDD(worker->cond); 180 CDD(worker->cond);
175 LKD(worker->mutex); 181 LKD(worker->mutex);
176 182
@@ -319,41 +325,41 @@ _ecore_short_job(PH(thread))
319 Ecore_Pthread_Worker *work; 325 Ecore_Pthread_Worker *work;
320 int cancel; 326 int cancel;
321 327
322 LKL(_ecore_pending_job_threads_mutex); 328 SLKL(_ecore_pending_job_threads_mutex);
323 329
324 if (!_ecore_pending_job_threads) 330 if (!_ecore_pending_job_threads)
325 { 331 {
326 LKU(_ecore_pending_job_threads_mutex); 332 SLKU(_ecore_pending_job_threads_mutex);
327 return; 333 return;
328 } 334 }
329 335
330 work = eina_list_data_get(_ecore_pending_job_threads); 336 work = eina_list_data_get(_ecore_pending_job_threads);
331 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, 337 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads,
332 _ecore_pending_job_threads); 338 _ecore_pending_job_threads);
333 LKU(_ecore_pending_job_threads_mutex); 339 SLKU(_ecore_pending_job_threads_mutex);
334 340
335 LKL(_ecore_running_job_mutex); 341 SLKL(_ecore_running_job_mutex);
336 _ecore_running_job = eina_list_append(_ecore_running_job, work); 342 _ecore_running_job = eina_list_append(_ecore_running_job, work);
337 LKU(_ecore_running_job_mutex); 343 SLKU(_ecore_running_job_mutex);
338 344
339 LKL(work->cancel_mutex); 345 SLKL(work->cancel_mutex);
340 cancel = work->cancel; 346 cancel = work->cancel;
341 LKU(work->cancel_mutex); 347 SLKU(work->cancel_mutex);
342 work->self = thread; 348 work->self = thread;
343 if (!cancel) 349 if (!cancel)
344 work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work); 350 work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work);
345 351
346 LKL(_ecore_running_job_mutex); 352 SLKL(_ecore_running_job_mutex);
347 _ecore_running_job = eina_list_remove(_ecore_running_job, work); 353 _ecore_running_job = eina_list_remove(_ecore_running_job, work);
348 LKU(_ecore_running_job_mutex); 354 SLKU(_ecore_running_job_mutex);
349 355
350 if (work->reschedule) 356 if (work->reschedule)
351 { 357 {
352 work->reschedule = EINA_FALSE; 358 work->reschedule = EINA_FALSE;
353 359
354 LKL(_ecore_pending_job_threads_mutex); 360 SLKL(_ecore_pending_job_threads_mutex);
355 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work); 361 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
356 LKU(_ecore_pending_job_threads_mutex); 362 SLKU(_ecore_pending_job_threads_mutex);
357 } 363 }
358 else 364 else
359 { 365 {
@@ -367,40 +373,40 @@ _ecore_feedback_job(PH(thread))
367 Ecore_Pthread_Worker *work; 373 Ecore_Pthread_Worker *work;
368 int cancel; 374 int cancel;
369 375
370 LKL(_ecore_pending_job_threads_mutex); 376 SLKL(_ecore_pending_job_threads_mutex);
371 377
372 if (!_ecore_pending_job_threads_feedback) 378 if (!_ecore_pending_job_threads_feedback)
373 { 379 {
374 LKU(_ecore_pending_job_threads_mutex); 380 SLKU(_ecore_pending_job_threads_mutex);
375 return; 381 return;
376 } 382 }
377 383
378 work = eina_list_data_get(_ecore_pending_job_threads_feedback); 384 work = eina_list_data_get(_ecore_pending_job_threads_feedback);
379 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, 385 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback,
380 _ecore_pending_job_threads_feedback); 386 _ecore_pending_job_threads_feedback);
381 LKU(_ecore_pending_job_threads_mutex); 387 SLKU(_ecore_pending_job_threads_mutex);
382 LKL(_ecore_running_job_mutex); 388 SLKL(_ecore_running_job_mutex);
383 _ecore_running_job = eina_list_append(_ecore_running_job, work); 389 _ecore_running_job = eina_list_append(_ecore_running_job, work);
384 LKU(_ecore_running_job_mutex); 390 SLKU(_ecore_running_job_mutex);
385 391
386 LKL(work->cancel_mutex); 392 SLKL(work->cancel_mutex);
387 cancel = work->cancel; 393 cancel = work->cancel;
388 LKU(work->cancel_mutex); 394 SLKU(work->cancel_mutex);
389 work->self = thread; 395 work->self = thread;
390 if (!cancel) 396 if (!cancel)
391 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work); 397 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
392 398
393 LKL(_ecore_running_job_mutex); 399 SLKL(_ecore_running_job_mutex);
394 _ecore_running_job = eina_list_remove(_ecore_running_job, work); 400 _ecore_running_job = eina_list_remove(_ecore_running_job, work);
395 LKU(_ecore_running_job_mutex); 401 SLKU(_ecore_running_job_mutex);
396 402
397 if (work->reschedule) 403 if (work->reschedule)
398 { 404 {
399 work->reschedule = EINA_FALSE; 405 work->reschedule = EINA_FALSE;
400 406
401 LKL(_ecore_pending_job_threads_mutex); 407 SLKL(_ecore_pending_job_threads_mutex);
402 _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, work); 408 _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, work);
403 LKU(_ecore_pending_job_threads_mutex); 409 SLKU(_ecore_pending_job_threads_mutex);
404 } 410 }
405 else 411 else
406 { 412 {
@@ -434,13 +440,13 @@ restart:
434 440
435 /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */ 441 /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */
436 442
437 LKL(_ecore_pending_job_threads_mutex); 443 SLKL(_ecore_pending_job_threads_mutex);
438 if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback) 444 if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback)
439 { 445 {
440 LKU(_ecore_pending_job_threads_mutex); 446 SLKU(_ecore_pending_job_threads_mutex);
441 goto restart; 447 goto restart;
442 } 448 }
443 LKU(_ecore_pending_job_threads_mutex); 449 SLKU(_ecore_pending_job_threads_mutex);
444 450
445 /* Sleep a little to prevent premature death */ 451 /* Sleep a little to prevent premature death */
446#ifdef _WIN32 452#ifdef _WIN32
@@ -449,17 +455,17 @@ restart:
449 usleep(50); 455 usleep(50);
450#endif 456#endif
451 457
452 LKL(_ecore_pending_job_threads_mutex); 458 SLKL(_ecore_pending_job_threads_mutex);
453 if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback) 459 if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback)
454 { 460 {
455 LKU(_ecore_pending_job_threads_mutex); 461 SLKU(_ecore_pending_job_threads_mutex);
456 goto restart; 462 goto restart;
457 } 463 }
458 _ecore_thread_count--; 464 _ecore_thread_count--;
459 465
460 ecore_main_loop_thread_safe_call_async((Ecore_Cb) _ecore_thread_join, 466 ecore_main_loop_thread_safe_call_async((Ecore_Cb) _ecore_thread_join,
461 (void*)(intptr_t)PHS()); 467 (void*)(intptr_t)PHS());
462 LKU(_ecore_pending_job_threads_mutex); 468 SLKU(_ecore_pending_job_threads_mutex);
463 469
464 return NULL; 470 return NULL;
465} 471}
@@ -477,7 +483,7 @@ _ecore_thread_worker_new(void)
477 _ecore_thread_worker_count++; 483 _ecore_thread_worker_count++;
478 } 484 }
479 485
480 LKI(result->cancel_mutex); 486 SLKI(result->cancel_mutex);
481 LKI(result->mutex); 487 LKI(result->mutex);
482 CDI(result->cond, result->mutex); 488 CDI(result->cond, result->mutex);
483 489
@@ -491,10 +497,10 @@ _ecore_thread_init(void)
491 if (_ecore_thread_count_max <= 0) 497 if (_ecore_thread_count_max <= 0)
492 _ecore_thread_count_max = 1; 498 _ecore_thread_count_max = 1;
493 499
494 LKI(_ecore_pending_job_threads_mutex); 500 SLKI(_ecore_pending_job_threads_mutex);
495 LRWKI(_ecore_thread_global_hash_lock); 501 LRWKI(_ecore_thread_global_hash_lock);
496 LKI(_ecore_thread_global_hash_mutex); 502 LKI(_ecore_thread_global_hash_mutex);
497 LKI(_ecore_running_job_mutex); 503 SLKI(_ecore_running_job_mutex);
498 CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex); 504 CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex);
499} 505}
500 506
@@ -507,7 +513,7 @@ _ecore_thread_shutdown(void)
507 Eina_Bool test; 513 Eina_Bool test;
508 int iteration = 0; 514 int iteration = 0;
509 515
510 LKL(_ecore_pending_job_threads_mutex); 516 SLKL(_ecore_pending_job_threads_mutex);
511 517
512 EINA_LIST_FREE(_ecore_pending_job_threads, work) 518 EINA_LIST_FREE(_ecore_pending_job_threads, work)
513 { 519 {
@@ -523,17 +529,17 @@ _ecore_thread_shutdown(void)
523 free(work); 529 free(work);
524 } 530 }
525 531
526 LKU(_ecore_pending_job_threads_mutex); 532 SLKU(_ecore_pending_job_threads_mutex);
527 LKL(_ecore_running_job_mutex); 533 SLKL(_ecore_running_job_mutex);
528 534
529 EINA_LIST_FOREACH(_ecore_running_job, l, work) 535 EINA_LIST_FOREACH(_ecore_running_job, l, work)
530 ecore_thread_cancel((Ecore_Thread*) work); 536 ecore_thread_cancel((Ecore_Thread*) work);
531 537
532 LKU(_ecore_running_job_mutex); 538 SLKU(_ecore_running_job_mutex);
533 539
534 do 540 do
535 { 541 {
536 LKL(_ecore_pending_job_threads_mutex); 542 SLKL(_ecore_pending_job_threads_mutex);
537 if (_ecore_thread_count > 0) 543 if (_ecore_thread_count > 0)
538 { 544 {
539 test = EINA_TRUE; 545 test = EINA_TRUE;
@@ -542,7 +548,7 @@ _ecore_thread_shutdown(void)
542 { 548 {
543 test = EINA_FALSE; 549 test = EINA_FALSE;
544 } 550 }
545 LKU(_ecore_pending_job_threads_mutex); 551 SLKU(_ecore_pending_job_threads_mutex);
546 iteration++; 552 iteration++;
547 if (test) usleep(50000); 553 if (test) usleep(50000);
548 } 554 }
@@ -562,10 +568,10 @@ _ecore_thread_shutdown(void)
562 free(work); 568 free(work);
563 } 569 }
564 570
565 LKD(_ecore_pending_job_threads_mutex); 571 SLKD(_ecore_pending_job_threads_mutex);
566 LRWKD(_ecore_thread_global_hash_lock); 572 LRWKD(_ecore_thread_global_hash_lock);
567 LKD(_ecore_thread_global_hash_mutex); 573 LKD(_ecore_thread_global_hash_mutex);
568 LKD(_ecore_running_job_mutex); 574 SLKD(_ecore_running_job_mutex);
569 CDD(_ecore_thread_global_hash_cond); 575 CDD(_ecore_thread_global_hash_cond);
570} 576}
571 577
@@ -605,27 +611,27 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
605 work->self = 0; 611 work->self = 0;
606 work->hash = NULL; 612 work->hash = NULL;
607 613
608 LKL(_ecore_pending_job_threads_mutex); 614 SLKL(_ecore_pending_job_threads_mutex);
609 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work); 615 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
610 616
611 if (_ecore_thread_count == _ecore_thread_count_max) 617 if (_ecore_thread_count == _ecore_thread_count_max)
612 { 618 {
613 LKU(_ecore_pending_job_threads_mutex); 619 SLKU(_ecore_pending_job_threads_mutex);
614 return (Ecore_Thread *)work; 620 return (Ecore_Thread *)work;
615 } 621 }
616 622
617 LKU(_ecore_pending_job_threads_mutex); 623 SLKU(_ecore_pending_job_threads_mutex);
618 624
619 /* One more thread could be created. */ 625 /* One more thread could be created. */
620 eina_threads_init(); 626 eina_threads_init();
621 627
622 LKL(_ecore_pending_job_threads_mutex); 628 SLKL(_ecore_pending_job_threads_mutex);
623 629
624 retry: 630 retry:
625 if (PHC(thread, _ecore_thread_worker, NULL)) 631 if (PHC(thread, _ecore_thread_worker, NULL))
626 { 632 {
627 _ecore_thread_count++; 633 _ecore_thread_count++;
628 LKU(_ecore_pending_job_threads_mutex); 634 SLKU(_ecore_pending_job_threads_mutex);
629 return (Ecore_Thread *)work; 635 return (Ecore_Thread *)work;
630 } 636 }
631 if (!tried) 637 if (!tried)
@@ -645,7 +651,7 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
645 _ecore_thread_worker_free(work); 651 _ecore_thread_worker_free(work);
646 work = NULL; 652 work = NULL;
647 } 653 }
648 LKU(_ecore_pending_job_threads_mutex); 654 SLKU(_ecore_pending_job_threads_mutex);
649 655
650 eina_threads_shutdown(); 656 eina_threads_shutdown();
651 657
@@ -661,9 +667,9 @@ ecore_thread_cancel(Ecore_Thread *thread)
661 667
662 if (!work) 668 if (!work)
663 return EINA_TRUE; 669 return EINA_TRUE;
664 LKL(work->cancel_mutex); 670 SLKL(work->cancel_mutex);
665 cancel = work->cancel; 671 cancel = work->cancel;
666 LKU(work->cancel_mutex); 672 SLKU(work->cancel_mutex);
667 if (cancel) 673 if (cancel)
668 return EINA_FALSE; 674 return EINA_FALSE;
669 675
@@ -675,7 +681,7 @@ ecore_thread_cancel(Ecore_Thread *thread)
675 goto on_exit; 681 goto on_exit;
676 } 682 }
677 683
678 LKL(_ecore_pending_job_threads_mutex); 684 SLKL(_ecore_pending_job_threads_mutex);
679 685
680 if ((have_main_loop_thread) && 686 if ((have_main_loop_thread) &&
681 (PHE(get_main_loop_thread(), PHS()))) 687 (PHE(get_main_loop_thread(), PHS())))
@@ -687,7 +693,7 @@ ecore_thread_cancel(Ecore_Thread *thread)
687 { 693 {
688 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, l); 694 _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, l);
689 695
690 LKU(_ecore_pending_job_threads_mutex); 696 SLKU(_ecore_pending_job_threads_mutex);
691 697
692 if (work->func_cancel) 698 if (work->func_cancel)
693 work->func_cancel((void *)work->data, (Ecore_Thread *)work); 699 work->func_cancel((void *)work->data, (Ecore_Thread *)work);
@@ -703,7 +709,7 @@ ecore_thread_cancel(Ecore_Thread *thread)
703 { 709 {
704 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, l); 710 _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, l);
705 711
706 LKU(_ecore_pending_job_threads_mutex); 712 SLKU(_ecore_pending_job_threads_mutex);
707 713
708 if (work->func_cancel) 714 if (work->func_cancel)
709 work->func_cancel((void *)work->data, (Ecore_Thread *)work); 715 work->func_cancel((void *)work->data, (Ecore_Thread *)work);
@@ -714,15 +720,15 @@ ecore_thread_cancel(Ecore_Thread *thread)
714 } 720 }
715 } 721 }
716 722
717 LKU(_ecore_pending_job_threads_mutex); 723 SLKU(_ecore_pending_job_threads_mutex);
718 724
719 work = (Ecore_Pthread_Worker *)thread; 725 work = (Ecore_Pthread_Worker *)thread;
720 726
721 /* Delay the destruction */ 727 /* Delay the destruction */
722 on_exit: 728 on_exit:
723 LKL(work->cancel_mutex); 729 SLKL(work->cancel_mutex);
724 work->cancel = EINA_TRUE; 730 work->cancel = EINA_TRUE;
725 LKU(work->cancel_mutex); 731 SLKU(work->cancel_mutex);
726 732
727 return EINA_FALSE; 733 return EINA_FALSE;
728} 734}
@@ -734,7 +740,7 @@ ecore_thread_check(Ecore_Thread *thread)
734 int cancel; 740 int cancel;
735 741
736 if (!worker) return EINA_TRUE; 742 if (!worker) return EINA_TRUE;
737 LKL(worker->cancel_mutex); 743 SLKL(worker->cancel_mutex);
738 744
739 cancel = worker->cancel; 745 cancel = worker->cancel;
740 /* FIXME: there is an insane bug driving me nuts here. I don't know if 746 /* FIXME: there is an insane bug driving me nuts here. I don't know if
@@ -742,7 +748,7 @@ ecore_thread_check(Ecore_Thread *thread)
742 But ecore_thread_check will only work correctly with a printf, all the volatile, 748 But ecore_thread_check will only work correctly with a printf, all the volatile,
743 lock and even usleep don't help here... */ 749 lock and even usleep don't help here... */
744 /* fprintf(stderr, "wc: %i\n", cancel); */ 750 /* fprintf(stderr, "wc: %i\n", cancel); */
745 LKU(worker->cancel_mutex); 751 SLKU(worker->cancel_mutex);
746 return cancel; 752 return cancel;
747} 753}
748 754
@@ -813,26 +819,26 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
813 819
814 worker->no_queue = EINA_FALSE; 820 worker->no_queue = EINA_FALSE;
815 821
816 LKL(_ecore_pending_job_threads_mutex); 822 SLKL(_ecore_pending_job_threads_mutex);
817 _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, worker); 823 _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, worker);
818 824
819 if (_ecore_thread_count == _ecore_thread_count_max) 825 if (_ecore_thread_count == _ecore_thread_count_max)
820 { 826 {
821 LKU(_ecore_pending_job_threads_mutex); 827 SLKU(_ecore_pending_job_threads_mutex);
822 return (Ecore_Thread *)worker; 828 return (Ecore_Thread *)worker;
823 } 829 }
824 830
825 LKU(_ecore_pending_job_threads_mutex); 831 SLKU(_ecore_pending_job_threads_mutex);
826 832
827 /* One more thread could be created. */ 833 /* One more thread could be created. */
828 eina_threads_init(); 834 eina_threads_init();
829 835
830 LKL(_ecore_pending_job_threads_mutex); 836 SLKL(_ecore_pending_job_threads_mutex);
831 retry: 837 retry:
832 if (PHC(thread, _ecore_thread_worker, NULL)) 838 if (PHC(thread, _ecore_thread_worker, NULL))
833 { 839 {
834 _ecore_thread_count++; 840 _ecore_thread_count++;
835 LKU(_ecore_pending_job_threads_mutex); 841 SLKU(_ecore_pending_job_threads_mutex);
836 return (Ecore_Thread *)worker; 842 return (Ecore_Thread *)worker;
837 } 843 }
838 if (!tried) 844 if (!tried)
@@ -841,12 +847,12 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
841 tried = EINA_TRUE; 847 tried = EINA_TRUE;
842 goto retry; 848 goto retry;
843 } 849 }
844 LKU(_ecore_pending_job_threads_mutex); 850 SLKU(_ecore_pending_job_threads_mutex);
845 851
846 eina_threads_shutdown(); 852 eina_threads_shutdown();
847 853
848on_error: 854on_error:
849 LKL(_ecore_pending_job_threads_mutex); 855 SLKL(_ecore_pending_job_threads_mutex);
850 if (_ecore_thread_count == 0) 856 if (_ecore_thread_count == 0)
851 { 857 {
852 _ecore_pending_job_threads_feedback = eina_list_remove(_ecore_pending_job_threads_feedback, 858 _ecore_pending_job_threads_feedback = eina_list_remove(_ecore_pending_job_threads_feedback,
@@ -862,7 +868,7 @@ on_error:
862 worker = NULL; 868 worker = NULL;
863 } 869 }
864 } 870 }
865 LKU(_ecore_pending_job_threads_mutex); 871 SLKU(_ecore_pending_job_threads_mutex);
866 872
867 return (Ecore_Thread *)worker; 873 return (Ecore_Thread *)worker;
868} 874}
@@ -1004,9 +1010,9 @@ ecore_thread_pending_get(void)
1004 int ret; 1010 int ret;
1005 1011
1006 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0); 1012 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
1007 LKL(_ecore_pending_job_threads_mutex); 1013 SLKL(_ecore_pending_job_threads_mutex);
1008 ret = eina_list_count(_ecore_pending_job_threads); 1014 ret = eina_list_count(_ecore_pending_job_threads);
1009 LKU(_ecore_pending_job_threads_mutex); 1015 SLKU(_ecore_pending_job_threads_mutex);
1010 return ret; 1016 return ret;
1011} 1017}
1012 1018
@@ -1016,9 +1022,9 @@ ecore_thread_pending_feedback_get(void)
1016 int ret; 1022 int ret;
1017 1023
1018 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0); 1024 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
1019 LKL(_ecore_pending_job_threads_mutex); 1025 SLKL(_ecore_pending_job_threads_mutex);
1020 ret = eina_list_count(_ecore_pending_job_threads_feedback); 1026 ret = eina_list_count(_ecore_pending_job_threads_feedback);
1021 LKU(_ecore_pending_job_threads_mutex); 1027 SLKU(_ecore_pending_job_threads_mutex);
1022 return ret; 1028 return ret;
1023} 1029}
1024 1030
@@ -1028,9 +1034,9 @@ ecore_thread_pending_total_get(void)
1028 int ret; 1034 int ret;
1029 1035
1030 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0); 1036 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
1031 LKL(_ecore_pending_job_threads_mutex); 1037 SLKL(_ecore_pending_job_threads_mutex);
1032 ret = eina_list_count(_ecore_pending_job_threads) + eina_list_count(_ecore_pending_job_threads_feedback); 1038 ret = eina_list_count(_ecore_pending_job_threads) + eina_list_count(_ecore_pending_job_threads_feedback);
1033 LKU(_ecore_pending_job_threads_mutex); 1039 SLKU(_ecore_pending_job_threads_mutex);
1034 return ret; 1040 return ret;
1035} 1041}
1036 1042
@@ -1064,9 +1070,9 @@ ecore_thread_available_get(void)
1064{ 1070{
1065 int ret; 1071 int ret;
1066 1072
1067 LKL(_ecore_pending_job_threads_mutex); 1073 SLKL(_ecore_pending_job_threads_mutex);
1068 ret = _ecore_thread_count_max - _ecore_thread_count; 1074 ret = _ecore_thread_count_max - _ecore_thread_count;
1069 LKU(_ecore_pending_job_threads_mutex); 1075 SLKU(_ecore_pending_job_threads_mutex);
1070 return ret; 1076 return ret;
1071} 1077}
1072 1078