summaryrefslogtreecommitdiff
path: root/tests/reuse1.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-11-03 01:08:41 +0000
committerrpj <rpj>2004-11-03 01:08:41 +0000
commitec8290acdaea21b16d98f1ef5d4ae8a28ab2109a (patch)
tree0bd3750ec1cc12594b6cfe69473e393da6ec101b /tests/reuse1.c
parentcccaf0c2c82e78a72d69a4a50c872f308bed2f65 (diff)
Mutex, semaphore, thread ID, test suite changes - see ChangeLogs
Diffstat (limited to 'tests/reuse1.c')
-rw-r--r--tests/reuse1.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/reuse1.c b/tests/reuse1.c
index 2b74955..8e8ca54 100644
--- a/tests/reuse1.c
+++ b/tests/reuse1.c
@@ -82,7 +82,7 @@ static int washere = 0;
void * func(void * arg)
{
washere = 1;
- return (void *) 0;
+ return arg;
}
int
@@ -107,11 +107,16 @@ main()
for (i = 1; i < NUMTHREADS; i++)
{
washere = 0;
- assert(pthread_create(&t, &attr, func, NULL) == 0);
+ assert(pthread_create(&t, &attr, func, (void *) i) == 0);
pthread_join(t, &result);
- assert(result == 0);
+ assert((int) result == i);
assert(washere == 1);
- assert(t == last_t);
+ /* thread IDs should be unique */
+ assert(!pthread_equal(t, last_t));
+ /* thread struct pointers should be the same */
+ assert(t.p == last_t.p);
+ /* thread handle reuse counter should be different by one */
+ assert(t.x == last_t.x+1);
last_t = t;
}