forked from enlightenment/efl
Eina: add affinity to win32 code.
It's not working yet: * eina_thread.c:152:33: error: 'index' undeclared (first use in this function) * eina_thread.c:295:4: warning: passing argument 3 of '_eina_thread_win32_create' from incompatible pointer type [enabled by default] also: * line 142, is it normal that we call eina_list_append() with tw being NULL ? * is what I did in the close_thread label correct ? SVN revision: 78416
This commit is contained in:
parent
2de9c7a47b
commit
e082ab0e74
|
@ -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])
|
||||
;;
|
||||
|
|
|
@ -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,17 +121,23 @@ _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;
|
||||
|
|
Loading…
Reference in New Issue