Index: Python/thread.c =================================================================== --- Python/thread.c (revision 68528) +++ Python/thread.c (working copy) @@ -137,10 +137,6 @@ #include "thread_beos.h" #endif -#ifdef WINCE_THREADS -#include "thread_wince.h" -#endif - #ifdef PLAN9_THREADS #include "thread_plan9.h" #endif Index: Python/thread_nt.h =================================================================== --- Python/thread_nt.h (revision 68528) +++ Python/thread_nt.h (working copy) @@ -106,8 +106,13 @@ void *arg; } callobj; -/* thunker to call a __cdecl function instead of a __stdcall */ +/* thunker to call adapt between the function type used by the system's +thread start function and the internally used one. */ +#if defined(MS_WINCE) +static DWORD WINAPI +#else static unsigned __stdcall +#endif bootstrap(void *call) { callobj *obj = (callobj*)call; @@ -135,11 +140,17 @@ return -1; obj->func = func; obj->arg = arg; +#if defined(MS_WINCE) + hThread = CreateThread(NULL, + Py_SAFE_DOWNCAST(_pythread_stacksize, Py_ssize_t, SIZE_T), + bootstrap, obj, 0, &threadID); +#else hThread = (HANDLE)_beginthreadex(0, Py_SAFE_DOWNCAST(_pythread_stacksize, Py_ssize_t, unsigned int), bootstrap, obj, 0, &threadID); +#endif if (hThread == 0) { /* I've seen errno == EAGAIN here, which means "there are * too many threads". @@ -152,7 +163,6 @@ else { dprintf(("%ld: PyThread_start_new_thread succeeded: %p\n", PyThread_get_thread_ident(), (void*)hThread)); - /* wait for thread to initialize, so we can get its id */ CloseHandle(hThread); } return (long) threadID; @@ -177,7 +187,11 @@ dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident())); if (!initialized) exit(0); +#if defined(MS_WINCE) + ExitThread(0); +#else _endthreadex(0); +#endif } #ifndef NO_EXIT_PROG