aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--m4/efl_threads.m41
-rw-r--r--src/lib/eina/eina_thread.c20
2 files changed, 14 insertions, 7 deletions
diff --git a/m4/efl_threads.m4 b/m4/efl_threads.m4
index a1bcc0308..bba617f95 100644
--- a/m4/efl_threads.m4
+++ b/m4/efl_threads.m4
@@ -24,6 +24,7 @@ _efl_have_win32_threads="no"
case "$host_os" in
mingw*)
_efl_have_win32_threads="yes"
+ efl_have_setaffinity="yes"
AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
;;
diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c
index 993b47912..401568121 100644
--- a/src/lib/eina/eina_thread.c
+++ b/src/lib/eina/eina_thread.c
@@ -22,10 +22,6 @@
#include <stdlib.h>
-#ifdef HAVE_EVIL
-# include <Evil.h>
-#endif
-
#include "eina_config.h"
#include "eina_thread.h"
#include "eina_sched.h"
@@ -35,6 +31,8 @@
# elif defined(_WIN32)
+# include "eina_list.h"
+
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
@@ -72,6 +70,8 @@ static Eina_Thread
_eina_thread_win32_self(void)
{
HANDLE t;
+ Eina_Thread_Win32 *tw;
+ Eina_List *l;
t = GetCurrentThread();
EINA_LIST_FOREACH(_thread_running, l, tw)
@@ -121,20 +121,26 @@ _eina_thread_win32_create(Eina_Thread *t,
} while (tw->index == 0); /* prevent having a "false" main loop */
}
- tw->func = f;
- tw->data = d;
+ tw->func = func;
+ tw->data = (void *)data;
tw->thread = CreateThread(NULL, 0, _eina_thread_win32_cb, tw, 0, NULL);
if (!tw->thread) goto on_error;
+ if (!SetThreadAffinityMask(tw->thread, 1 << affinity))
+ goto close_thread;
+
_thread_running = eina_list_append(_thread_running, tw);
*t = tw->index;
return EINA_TRUE;
+ close_thread:
+ Closehandle(tw->thread);
+ tw->thread = NULL;
on_error:
_thread_pool = eina_list_append(_thread_pool, tw);
- return EINA_FALSE;
+ return EINA_FALSE;
}
static void *