summaryrefslogtreecommitdiff
path: root/src/threading.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/threading.c')
-rw-r--r--src/threading.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/threading.c b/src/threading.c
index d19fe1a..754b6d1 100644
--- a/src/threading.c
+++ b/src/threading.c
@@ -42,7 +42,7 @@ THE SOFTWARE.
42#include "threading.h" 42#include "threading.h"
43#include "lua.h" 43#include "lua.h"
44 44
45#if !defined( PLATFORM_WIN32) && !defined( PLATFORM_POCKETPC) 45#if !defined( PLATFORM_XBOX) && !defined( PLATFORM_WIN32) && !defined( PLATFORM_POCKETPC)
46# include <sys/time.h> 46# include <sys/time.h>
47#endif // non-WIN32 timing 47#endif // non-WIN32 timing
48 48
@@ -83,7 +83,7 @@ THE SOFTWARE.
83* FAIL is for unexpected API return values - essentially programming 83* FAIL is for unexpected API return values - essentially programming
84* error in _this_ code. 84* error in _this_ code.
85*/ 85*/
86#if defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC) 86#if defined( PLATFORM_XBOX) || defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC)
87static void FAIL( const char *funcname, int rc ) { 87static void FAIL( const char *funcname, int rc ) {
88 fprintf( stderr, "%s() failed! (%d)\n", funcname, rc ); 88 fprintf( stderr, "%s() failed! (%d)\n", funcname, rc );
89#ifdef _MSC_VER 89#ifdef _MSC_VER
@@ -102,7 +102,7 @@ static void FAIL( const char *funcname, int rc ) {
102*/ 102*/
103time_d now_secs(void) { 103time_d now_secs(void) {
104 104
105#if defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC) 105#if defined( PLATFORM_XBOX) || defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC)
106 /* 106 /*
107 * Windows FILETIME values are "100-nanosecond intervals since 107 * Windows FILETIME values are "100-nanosecond intervals since
108 * January 1, 1601 (UTC)" (MSDN). Well, we'd want Unix Epoch as 108 * January 1, 1601 (UTC)" (MSDN). Well, we'd want Unix Epoch as
@@ -226,7 +226,7 @@ static void prepare_timeout( struct timespec *ts, time_d abs_secs ) {
226// valid values N * 4KB 226// valid values N * 4KB
227// 227//
228#ifndef _THREAD_STACK_SIZE 228#ifndef _THREAD_STACK_SIZE
229# if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) || (defined PLATFORM_CYGWIN) 229# if defined( PLATFORM_XBOX) || defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC) || defined( PLATFORM_CYGWIN)
230# define _THREAD_STACK_SIZE 0 230# define _THREAD_STACK_SIZE 0
231 // Win32: does it work with less? 231 // Win32: does it work with less?
232# elif (defined PLATFORM_OSX) 232# elif (defined PLATFORM_OSX)
@@ -311,10 +311,15 @@ bool_t THREAD_WAIT_IMPL( THREAD_T *ref, double secs)
311 return TRUE; 311 return TRUE;
312 } 312 }
313 // 313 //
314 void THREAD_KILL( THREAD_T *ref ) { 314 void THREAD_KILL( THREAD_T *ref )
315 if (!TerminateThread( *ref, 0 )) FAIL("TerminateThread", GetLastError()); 315 {
316 *ref= NULL; 316 // nonexistent on Xbox360, simply disable until a better solution is found
317 } 317 #if !defined( PLATFORM_XBOX)
318 // in theory no-one should call this as it is very dangerous (memory and mutex leaks, no notification of DLLs, etc.)
319 if (!TerminateThread( *ref, 0 )) FAIL("TerminateThread", GetLastError());
320 #endif // PLATFORM_XBOX
321 *ref= NULL;
322 }
318 323
319#if !defined __GNUC__ 324#if !defined __GNUC__
320 //see http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx 325 //see http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx