diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2012-10-19 07:18:11 +0000 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2012-10-19 07:18:11 +0000 |
commit | c1dee13b8e74bbda99eb34c8d2fdb5881c3d6e88 (patch) | |
tree | c1ea3ddce2d436588f4ae32d3e32fcee4240dc3e /legacy/evas/src/lib/engines | |
parent | c15b6044771d7cb32fe4bfb4a946f367344e80f9 (diff) |
evas: use new Eina_Thread API.
SVN revision: 78232
Diffstat (limited to 'legacy/evas/src/lib/engines')
-rw-r--r-- | legacy/evas/src/lib/engines/common/evas_pipe.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c index 48dcebac65..0d4734df08 100644 --- a/legacy/evas/src/lib/engines/common/evas_pipe.c +++ b/legacy/evas/src/lib/engines/common/evas_pipe.c | |||
@@ -1,9 +1,5 @@ | |||
1 | #include "evas_common.h" | 1 | #include "evas_common.h" |
2 | #include <unistd.h> | 2 | #include <unistd.h> |
3 | #include <pthread.h> | ||
4 | #ifdef HAVE_PTHREAD_AFFINITY | ||
5 | #include <sched.h> | ||
6 | #endif | ||
7 | 3 | ||
8 | #ifdef BUILD_PIPE_RENDER | 4 | #ifdef BUILD_PIPE_RENDER |
9 | 5 | ||
@@ -11,7 +7,7 @@ typedef struct _Thinfo | |||
11 | { | 7 | { |
12 | RGBA_Image *im; | 8 | RGBA_Image *im; |
13 | int thread_num; | 9 | int thread_num; |
14 | pthread_t thread_id; | 10 | Eina_Thread thread_id; |
15 | Eina_Barrier *barrier; | 11 | Eina_Barrier *barrier; |
16 | const Eina_Inlist *tasks; | 12 | const Eina_Inlist *tasks; |
17 | Eina_Array cutout_trash; | 13 | Eina_Array cutout_trash; |
@@ -869,50 +865,26 @@ evas_common_pipe_init(void) | |||
869 | eina_barrier_new(&(thbarrier[1]), thread_num + 1); | 865 | eina_barrier_new(&(thbarrier[1]), thread_num + 1); |
870 | for (i = 0; i < thread_num; i++) | 866 | for (i = 0; i < thread_num; i++) |
871 | { | 867 | { |
872 | pthread_attr_t attr; | ||
873 | #ifdef HAVE_PTHREAD_AFFINITY | ||
874 | cpu_set_t cpu; | ||
875 | #endif | ||
876 | |||
877 | pthread_attr_init(&attr); | ||
878 | #ifdef HAVE_PTHREAD_AFFINITY | ||
879 | CPU_ZERO(&cpu); | ||
880 | CPU_SET(i % cpunum, &cpu); | ||
881 | pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu); | ||
882 | #endif | ||
883 | thinfo[i].thread_num = i; | 868 | thinfo[i].thread_num = i; |
884 | thinfo[i].tasks = NULL; | 869 | thinfo[i].tasks = NULL; |
885 | thinfo[i].barrier = thbarrier; | 870 | thinfo[i].barrier = thbarrier; |
886 | /* setup initial locks */ | 871 | |
887 | pthread_create(&(thinfo[i].thread_id), &attr, | 872 | eina_thread_create(&(thinfo[i].thread_id), EINA_THREAD_NORMAL, i, |
888 | evas_common_pipe_thread, &(thinfo[i])); | 873 | evas_common_pipe_thread, &(thinfo[i])); |
889 | pthread_attr_destroy(&attr); | ||
890 | } | 874 | } |
891 | 875 | ||
892 | eina_barrier_new(&(task_thbarrier[0]), thread_num + 1); | 876 | eina_barrier_new(&(task_thbarrier[0]), thread_num + 1); |
893 | eina_barrier_new(&(task_thbarrier[1]), thread_num + 1); | 877 | eina_barrier_new(&(task_thbarrier[1]), thread_num + 1); |
894 | for (i = 0; i < thread_num; i++) | 878 | for (i = 0; i < thread_num; i++) |
895 | { | 879 | { |
896 | pthread_attr_t attr; | ||
897 | #ifdef HAVE_PTHREAD_AFFINITY | ||
898 | cpu_set_t cpu; | ||
899 | #endif | ||
900 | |||
901 | pthread_attr_init(&attr); | ||
902 | #ifdef HAVE_PTHREAD_AFFINITY | ||
903 | CPU_ZERO(&cpu); | ||
904 | CPU_SET(i % cpunum, &cpu); | ||
905 | pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu); | ||
906 | #endif | ||
907 | task_thinfo[i].thread_num = i; | 880 | task_thinfo[i].thread_num = i; |
908 | task_thinfo[i].tasks = NULL; | 881 | task_thinfo[i].tasks = NULL; |
909 | task_thinfo[i].barrier = task_thbarrier; | 882 | task_thinfo[i].barrier = task_thbarrier; |
910 | eina_array_step_set(&task_thinfo[i].cutout_trash, sizeof (Eina_Array), 8); | 883 | eina_array_step_set(&task_thinfo[i].cutout_trash, sizeof (Eina_Array), 8); |
911 | eina_array_step_set(&task_thinfo[i].rects_task, sizeof (Eina_Array), 8); | 884 | eina_array_step_set(&task_thinfo[i].rects_task, sizeof (Eina_Array), 8); |
912 | /* setup initial locks */ | 885 | |
913 | pthread_create(&(task_thinfo[i].thread_id), &attr, | 886 | eina_thread_create(&(task_thinfo[i].thread_id), EINA_THREAD_NORMAL, i, |
914 | evas_common_pipe_load, &(task_thinfo[i])); | 887 | evas_common_pipe_load, &(task_thinfo[i])); |
915 | pthread_attr_destroy(&attr); | ||
916 | } | 888 | } |
917 | } | 889 | } |
918 | 890 | ||