summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-10-19 07:18:11 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-10-19 07:18:11 +0000
commitc1dee13b8e74bbda99eb34c8d2fdb5881c3d6e88 (patch)
treec1ea3ddce2d436588f4ae32d3e32fcee4240dc3e /legacy
parentc15b6044771d7cb32fe4bfb4a946f367344e80f9 (diff)
evas: use new Eina_Thread API.
SVN revision: 78232
Diffstat (limited to '')
-rw-r--r--legacy/evas/configure.ac40
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c42
2 files changed, 7 insertions, 75 deletions
diff --git a/legacy/evas/configure.ac b/legacy/evas/configure.ac
index 3de0d2a2c2..0470472da0 100644
--- a/legacy/evas/configure.ac
+++ b/legacy/evas/configure.ac
@@ -943,46 +943,6 @@ EVAS_CHECK_IMAGE_LOADER([SVG], [${want_evas_image_loader_svg}])
943## Cpu based optimizations 943## Cpu based optimizations
944 944
945####################################### 945#######################################
946## PTHREADS
947
948# basic pthread support
949AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([Pthread support missing.])])
950# basic pthread support. eina does the rest.
951AC_CHECK_HEADERS([pthread.h],
952 [
953 CFLAGS_save="${CFLAGS}"
954 CFLAGS="${CFLAGS} -pthread"
955 LIBS_save="${LIBS}"
956 LIBS="${LIBS} -pthread"
957 AC_LINK_IFELSE(
958 [AC_LANG_PROGRAM([[
959#include <stdlib.h>
960#include <pthread.h>
961 ]],
962 [[
963pthread_create(NULL, NULL, NULL, NULL);
964 ]])],
965 [],
966 [AC_MSG_ERROR([You don't have pthread support.])])
967 AC_LINK_IFELSE(
968 [AC_LANG_PROGRAM([[
969#include <stdlib.h>
970#include <pthread.h>
971#include <sched.h>
972 ]],
973 [[
974pthread_attr_setaffinity_np(NULL, 0, NULL);
975 ]])],
976 [AC_DEFINE(HAVE_PTHREAD_AFFINITY, 1, [Pthread pthread_attr_setaffinity_np])],
977 [])
978 CFLAGS=${CFLAGS_save}
979 LIBS=${LIBS_save}
980 ],
981 [AC_MSG_ERROR([Missing pthread.h])])
982pthread_cflags="-pthread"
983pthread_libs="-pthread"
984
985#######################################
986## Pipe Renderer 946## Pipe Renderer
987build_pipe_render="no" 947build_pipe_render="no"
988 948
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