+2012-10-25 Roland McGrath <roland@hack.frob.com>
+
+ * tst-basic2.c (do_test): Return RESULT, not always zero.
+
+ * tst-cond25.c: Include <stdint.h>
+ (waiter): Add casts to uintptr_t between casting integer<->pointer.
+ (timed_waiter): Likewise.
+ (do_test_wait): Likewise.
+ * tst-cond-except.c (thr): Likewise.
+ (do_test): Use prototype definition.
+
2012-10-24 Joseph Myers <joseph@codesourcery.com>
Jim Blandy <jimb@codesourcery.com>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
{
int i, ret = 0;
void *tret = NULL;
- int seq = (int)u;
+ int seq = (uintptr_t) u;
for (i = 0; i < ITERS / NUM; i++)
{
if ((ret = pthread_mutex_lock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
goto out;
}
if ((ret = pthread_cond_wait (&cond, &mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:wait failed: %s\n", seq, strerror (ret));
goto unlock_out;
}
if ((ret = pthread_mutex_unlock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
goto out;
}
{
int i, ret;
void *tret = NULL;
- int seq = (int)u;
+ int seq = (uintptr_t) u;
for (i = 0; i < ITERS / NUM; i++)
{
if ((ret = clock_gettime(CLOCK_REALTIME, &ts)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("%u:clock_gettime failed: %s\n", seq, strerror (errno));
goto out;
}
if ((ret = pthread_mutex_lock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
goto out;
}
/* We should not time out either. */
if ((ret = pthread_cond_timedwait (&cond, &mutex, &ts)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:timedwait failed: %s\n", seq, strerror (ret));
goto unlock_out;
}
if ((ret = pthread_mutex_unlock (&mutex)) != 0)
{
- tret = (void *)1;
+ tret = (void *) (uintptr_t) 1;
printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
goto out;
}
goto out;
}
- if ((ret = pthread_mutexattr_setprotocol (&attr, PTHREAD_PRIO_INHERIT)) != 0)
+ if ((ret = pthread_mutexattr_setprotocol (&attr,
+ PTHREAD_PRIO_INHERIT)) != 0)
{
printf ("mutexattr_setprotocol failed: %s\n", strerror (ret));
goto out;
}
for (j = 0; j < NUM; j++)
- if ((ret = pthread_create (&w[j], NULL, f, (void *)j)) != 0)
+ if ((ret = pthread_create (&w[j], NULL,
+ f, (void *) (uintptr_t) j)) != 0)
{
printf ("waiter[%d]: create failed: %s\n", j, strerror (ret));
goto out;