From 11b839f08794de0d090811580a09aa6db5b21f2c Mon Sep 17 00:00:00 2001 From: bje Date: Sun, 4 Oct 1998 19:38:04 +0000 Subject: 1998-10-05 Ben Elliston * misc.c (pthread_equal): Correct inverted logic bug. * tests/create1.c: New file; test pthread_create(). Passes. * tests/equal.c: Poor test; remove. * tests/equal1.c New file; test pthread_equal(). Passes. --- tests/equal1.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/equal1.c (limited to 'tests/equal1.c') diff --git a/tests/equal1.c b/tests/equal1.c new file mode 100644 index 0000000..3b4c758 --- /dev/null +++ b/tests/equal1.c @@ -0,0 +1,34 @@ +#include +#include +#include + +void * func(void * arg) +{ + printf("Hello world %d\n", (int) arg); + Sleep(2000); + return arg; +} + +main() +{ + int rc; + pthread_t t1, t2; + rc = pthread_create(&t1, NULL, func, (void *) 1); + rc = pthread_create(&t1, NULL, func, (void *) 2); + + puts("testing t1 and t2: "); + if (pthread_equal(t1, t2)) + printf("equal\n"); + else + printf("not equal\n"); + + puts("testing t1 on itself: "); + if (pthread_equal(t1,t1)) + printf("equal\n"); + else + printf("not equal\n"); + + Sleep(8000); + + return 0; +} -- cgit v1.2.3