diff options
author | rpj <rpj> | 2004-05-06 00:55:13 +0000 |
---|---|---|
committer | rpj <rpj> | 2004-05-06 00:55:13 +0000 |
commit | 78b1607406fe42603b8aedd7642d1e4f944ee810 (patch) | |
tree | 752d8558e70c5590fe02a0cd35808aa75312082a | |
parent | 87441bbe5d3dae5e60f8ccf398aa2e17c1ad7b7a (diff) |
''
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | pthread.h | 7 | ||||
-rw-r--r-- | pthread_cancel.c | 6 | ||||
-rw-r--r-- | ptw32_getprocessors.c | 6 |
4 files changed, 16 insertions, 5 deletions
@@ -1,4 +1,4 @@ -2004-05-06 Makato Kato <raven@oldskool.jp> +2004-05-06 Makoto Kato <raven@oldskool.jp> * pthread.h (DWORD_PTR): Define typedef for older MSVC. * pthread_cancel.c (AMD64): Add architecture specific Context register. @@ -155,6 +155,13 @@ #ifdef PTW32_INCLUDE_WINDOWS_H #include <windows.h> + +#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) |