summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2011-06-30 02:07:14 +0000
committerrpj <rpj>2011-06-30 02:07:14 +0000
commit6e72bdd7414dff1db49dd943f440b201038a4576 (patch)
tree26cdde3533ef9b6114d099cc4da2af212b285c5c
parent5fdebbca2831af55fcd17d1819ec68dc17e2ec58 (diff)
Fixes for x64
-rw-r--r--ChangeLog6
-rw-r--r--create.c6
-rw-r--r--pthread_once.c4
-rw-r--r--tests/ChangeLog4
-rw-r--r--tests/once3.c2
-rwxr-xr-xtests/sequence1.c2
6 files changed, 18 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 956ad53..7b371c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-30 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * pthread_once.c: Tighten 'if' statement casting; fix interlocked
+ pointer cast for 64 bit compatibility (missed yesterday).
+ * create.c (stackSize): Now type size_t.
+
2011-06-29 Daniel Richard G. <skunk at iskunk dot org>
* ptw32_relmillisecs.c (ftime):
diff --git a/create.c b/create.c
index 881d537..654f6d4 100644
--- a/create.c
+++ b/create.c
@@ -90,7 +90,7 @@ pthread_create (pthread_t * tid,
int result = EAGAIN;
int run = PTW32_TRUE;
ThreadParms *parms = NULL;
- long stackSize;
+ size_t stackSize;
int priority;
pthread_t self;
@@ -205,7 +205,7 @@ pthread_create (pthread_t * tid,
tp->threadH =
threadH =
(HANDLE) _beginthreadex ((void *) NULL, /* No security info */
- (unsigned) stackSize, /* default stack size */
+ stackSize, /* default stack size */
ptw32_threadStart,
parms,
(unsigned)
@@ -238,7 +238,7 @@ pthread_create (pthread_t * tid,
tp->threadH =
threadH =
- (HANDLE) _beginthread (ptw32_threadStart, (unsigned) stackSize, /* default stack size */
+ (HANDLE) _beginthread (ptw32_threadStart, stackSize, /* default stack size */
parms);
/*
diff --git a/pthread_once.c b/pthread_once.c
index ca66dce..e18726c 100644
--- a/pthread_once.c
+++ b/pthread_once.c
@@ -54,7 +54,9 @@ pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
return EINVAL;
}
- if (!PTW32_INTERLOCKED_EXCHANGE_ADD((LPLONG)&once_control->done, (size_t)0)) /* MBR fence */
+ if ((PTW32_INTERLOCKED_VALUE)0 ==
+ (PTW32_INTERLOCKED_VALUE)PTW32_INTERLOCKED_EXCHANGE_ADD((PTW32_INTERLOCKED_PTR)&once_control->done,
+ (PTW32_INTERLOCKED_VALUE)0)) /* MBR fence */
{
ptw32_mcs_local_node_t node;
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 843837f..342c0c8 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2011-06-30 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * sequence1.c: Fix loop overrun.
+
2011-05-11 Ross Johnson <ross.johnson at homemail.com.au>
* GNUmakefile (GCE-debug): New target; expects pthreadGCE2d.dll.
diff --git a/tests/once3.c b/tests/once3.c
index 00fa421..ef12290 100644
--- a/tests/once3.c
+++ b/tests/once3.c
@@ -83,7 +83,7 @@ mythread(void * arg)
* Cancel every thread. These threads are deferred cancelable only, so
* only the thread performing the once routine (my_func) will see it (there are
* no other cancelation points here). The result will be that every thread
- * eventually cancels only when it becomes the new once thread.
+ * eventually cancels only when it becomes the new 'once' thread.
*/
assert(pthread_cancel(pthread_self()) == 0);
assert(pthread_once(&once[(int)(size_t)arg], myfunc) == 0);
diff --git a/tests/sequence1.c b/tests/sequence1.c
index e7d7db0..46388ee 100755
--- a/tests/sequence1.c
+++ b/tests/sequence1.c
@@ -112,7 +112,7 @@ main()
assert(pthread_attr_init(&attr) == 0);
assert(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0);
- for (i = 0; i <= NUMTHREADS+2; i++)
+ for (i = 0; i < NUMTHREADS+2; i++)
{
seqmap[i] = 0;
}