summaryrefslogtreecommitdiff
path: root/tests/semaphore1.c
diff options
context:
space:
mode:
authorrpj <rpj>2011-03-05 07:21:12 +0000
committerrpj <rpj>2011-03-05 07:21:12 +0000
commit85dfeaf6133e1b74eefed26cf76c3f8631c7dd1d (patch)
tree92e0f60e66f36f1ea1ca9cec4617d7f187698ecf /tests/semaphore1.c
parent275d03d3af64e4f5e1769584214f6fccc303456e (diff)
Rework pthread_join result arg casting
Diffstat (limited to 'tests/semaphore1.c')
-rw-r--r--tests/semaphore1.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/semaphore1.c b/tests/semaphore1.c
index 59e6aee..de349c7 100644
--- a/tests/semaphore1.c
+++ b/tests/semaphore1.c
@@ -119,17 +119,18 @@ main()
{
pthread_t t;
sem_t s;
- int result;
+ void* result1 = (void*)-1;
+ int result2;
assert(pthread_create(&t, NULL, thr, NULL) == 0);
- assert(pthread_join(t, (void *)&result) == 0);
- assert(result == 0);
+ assert(pthread_join(t, (void *)&result1) == 0);
+ assert((int)(size_t)result1 == 0);
assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
- assert((result = sem_trywait(&s)) == -1);
+ assert((result2 = sem_trywait(&s)) == -1);
- if ( result == -1 )
+ if (result2 == -1)
{
int err = errno;
printf("main: sem_trywait 1: expecting error %s: got %s\n",
@@ -141,11 +142,11 @@ main()
printf("main: ok 1\n");
}
- assert((result = sem_post(&s)) == 0);
+ assert((result2 = sem_post(&s)) == 0);
- assert((result = sem_trywait(&s)) == 0);
+ assert((result2 = sem_trywait(&s)) == 0);
- if ( result == -1 )
+ if ( result2 == -1 )
{
perror("main: sem_trywait 2");
}