summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--pthread.h7
-rw-r--r--pthread_cancel.c6
-rw-r--r--ptw32_getprocessors.c6
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 <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.
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 <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)