Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libpthread Revert to 1.1 and fix the casts by usin...
details: https://anonhg.NetBSD.org/src/rev/1470448dfa05
branches: trunk
changeset: 756704:1470448dfa05
user: hans <hans%NetBSD.org@localhost>
date: Thu Jul 29 12:56:16 2010 +0000
description:
Revert to 1.1 and fix the casts by using uintptr_t. Ok jruoho.
diffstat:
tests/lib/libpthread/t_join.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diffs (71 lines):
diff -r 906e4ceb2bd0 -r 1470448dfa05 tests/lib/libpthread/t_join.c
--- a/tests/lib/libpthread/t_join.c Thu Jul 29 12:17:31 2010 +0000
+++ b/tests/lib/libpthread/t_join.c Thu Jul 29 12:56:16 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_join.c,v 1.3 2010/07/29 12:17:31 jruoho Exp $ */
+/* $NetBSD: t_join.c,v 1.4 2010/07/29 12:56:16 hans Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_join.c,v 1.3 2010/07/29 12:17:31 jruoho Exp $");
+__RCSID("$NetBSD: t_join.c,v 1.4 2010/07/29 12:56:16 hans Exp $");
#include <errno.h>
#include <pthread.h>
@@ -64,8 +64,8 @@
{
pthread_t thread[25];
pthread_t caller;
- void *val;
- size_t i;
+ void *val = NULL;
+ uintptr_t i;
int rv;
caller = pthread_self();
@@ -86,7 +86,7 @@
error = true;
- rv = pthread_create(&thread[i], NULL, threadfunc2, NULL);
+ rv = pthread_create(&thread[i], NULL, threadfunc2, (void *)i);
ATF_REQUIRE_EQ(rv, 0);
@@ -102,9 +102,11 @@
*/
PTHREAD_REQUIRE(pthread_join(thread[i], &val));
- ATF_REQUIRE(val == NULL);
ATF_REQUIRE_EQ(error, false);
+ ATF_REQUIRE(val != NULL);
+ ATF_REQUIRE(val == (void *)(i + 1));
+
/*
* Once the thread has returned, ESRCH should
* again follow if we try to join it again.
@@ -129,15 +131,15 @@
static void *
threadfunc2(void *arg)
{
- static int i = 0;
- int j;
+ static uintptr_t i = 0;
+ uintptr_t j;
- j = (int)arg;
+ j = (uintptr_t)arg;
if (i++ == j)
error = false;
- pthread_exit(NULL);
+ pthread_exit((void *)i);
return NULL;
}
Home |
Main Index |
Thread Index |
Old Index