Commit 272308b2 authored by Geoffroy Couprie's avatar Geoffroy Couprie

WinCE: do an ugly thread cancellation without using QueueUserAPC

parent 01f7daf5
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#endif #endif
#if defined( UNDER_CE ) #if defined( UNDER_CE )
# include <windows.h> # define SleepEx(a,b) Sleep(a)
#endif #endif
#if defined(HAVE_SYS_TIME_H) #if defined(HAVE_SYS_TIME_H)
......
...@@ -49,6 +49,10 @@ static vlc_threadvar_t cancel_key; ...@@ -49,6 +49,10 @@ static vlc_threadvar_t cancel_key;
# include <execinfo.h> # include <execinfo.h>
#endif #endif
#ifdef UNDER_CE
# define WaitForSingleObjectEx(a,b,c) WaitForSingleObject(a,b)
#endif
/** /**
* Print a backtrace to the standard error for debugging purpose. * Print a backtrace to the standard error for debugging purpose.
*/ */
...@@ -689,6 +693,19 @@ void vlc_cancel (vlc_thread_t thread_id) ...@@ -689,6 +693,19 @@ void vlc_cancel (vlc_thread_t thread_id)
{ {
#if defined (LIBVLC_USE_PTHREAD_CANCEL) #if defined (LIBVLC_USE_PTHREAD_CANCEL)
pthread_cancel (thread_id); pthread_cancel (thread_id);
#elif defined (UNDER_CE)
/* HACK:There is no way to use something
* like QueueUserAPC on Windows CE, so I rely
* on some crappy arch specific code */
CONTEXT context;
context.ContextFlags = CONTEXT_CONTROL;
GetThreadContext (thread_id->handle, &context);
/* Setting the instruction pointer for the canceled thread */
#if defined(_ARM_) || defined(ARM)
context.Pc = (DWORD_PTR) vlc_cancel_self;
#endif
SetThreadContext (thread_id->handle, &context);
#elif defined (WIN32) #elif defined (WIN32)
QueueUserAPC (vlc_cancel_self, thread_id->handle, 0); QueueUserAPC (vlc_cancel_self, thread_id->handle, 0);
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment