From 78b1607406fe42603b8aedd7642d1e4f944ee810 Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 6 May 2004 00:55:13 +0000 Subject: '' --- ChangeLog | 2 +- pthread.h | 7 +++++++ pthread_cancel.c | 6 +++++- ptw32_getprocessors.c | 6 +++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75624eb..fd3506a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2004-05-06 Makato Kato +2004-05-06 Makoto Kato * pthread.h (DWORD_PTR): Define typedef for older MSVC. * pthread_cancel.c (AMD64): Add architecture specific Context register. diff --git a/pthread.h b/pthread.h index 34cacc0..56759b5 100644 --- a/pthread.h +++ b/pthread.h @@ -155,6 +155,13 @@ #ifdef PTW32_INCLUDE_WINDOWS_H #include + +#if _MSC_VER < 1300 +/* + * VC++6.0 or early compiler's header has no DWORD_PTR type. + */ +typedef unsigned long DWORD_PTR; +#endif #endif /* diff --git a/pthread_cancel.c b/pthread_cancel.c index 6f59b30..6af159f 100644 --- a/pthread_cancel.c +++ b/pthread_cancel.c @@ -54,6 +54,10 @@ #define PTW32_PROGCTR(Context) ((Context).Iar) #endif +#if defined(_AMD64_) +#define PTW32_PROGCTR(Context) ((Context).Rip) +#endif + #if !defined(PTW32_PROGCTR) #error Module contains CPU-specific code; modify and recompile. #endif @@ -155,7 +159,7 @@ pthread_cancel (pthread_t thread) thread->cancelState = PTHREAD_CANCEL_DISABLE; context.ContextFlags = CONTEXT_CONTROL; GetThreadContext(threadH, &context); - PTW32_PROGCTR(context) = (DWORD) ptw32_cancel_self; + PTW32_PROGCTR(context) = (DWORD_PTR) ptw32_cancel_self; SetThreadContext(threadH, &context); (void) pthread_mutex_unlock(&thread->cancelLock); ResumeThread(threadH); diff --git a/ptw32_getprocessors.c b/ptw32_getprocessors.c index ddb387a..01dfa3a 100644 --- a/ptw32_getprocessors.c +++ b/ptw32_getprocessors.c @@ -55,15 +55,15 @@ int ptw32_getprocessors(int * count) { - DWORD vProcessCPUs; - DWORD vSystemCPUs; + DWORD_PTR vProcessCPUs; + DWORD_PTR vSystemCPUs; int result = 0; if (GetProcessAffinityMask(GetCurrentProcess(), &vProcessCPUs, &vSystemCPUs)) { - DWORD bit; + DWORD_PTR bit; int CPUs = 0; for (bit = 1; bit != 0; bit <<= 1) -- cgit v1.2.3