summaryrefslogtreecommitdiff
path: root/tests/equal1.c
diff options
context:
space:
mode:
authorbje <bje>1998-10-04 19:38:04 +0000
committerbje <bje>1998-10-04 19:38:04 +0000
commit11b839f08794de0d090811580a09aa6db5b21f2c (patch)
treec41469a1ba35d67bb40fbf32d480a5b2c5533420 /tests/equal1.c
parent0477632dbe94f378853364cd868cc0f800cb5755 (diff)
1998-10-05 Ben Elliston <bje@cygnus.com>
* 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.
Diffstat (limited to 'tests/equal1.c')
-rw-r--r--tests/equal1.c34
1 files changed, 34 insertions, 0 deletions
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 <pthread.h>
+#include <stdio.h>
+#include <windows.h>
+
+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;
+}