Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/testsuite/winsup.api/pthread/equal1.c')
-rw-r--r--winsup/testsuite/winsup.api/pthread/equal1.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/winsup/testsuite/winsup.api/pthread/equal1.c b/winsup/testsuite/winsup.api/pthread/equal1.c
new file mode 100644
index 000000000..617a95664
--- /dev/null
+++ b/winsup/testsuite/winsup.api/pthread/equal1.c
@@ -0,0 +1,34 @@
+/*
+ * Test for pthread_equal.
+ *
+ * Depends on functions: pthread_create().
+ */
+
+#include "test.h"
+
+void * func(void * arg)
+{
+ Sleep(2000);
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t t1, t2;
+
+ assert(pthread_create(&t1, NULL, func, (void *) 1) == 0);
+
+ assert(pthread_create(&t2, NULL, func, (void *) 2) == 0);
+
+ assert(pthread_equal(t1, t2) == 0);
+
+ assert(pthread_equal(t1,t1) != 0);
+
+ /* This is a hack. We don't want to rely on pthread_join
+ yet if we can help it. */
+ Sleep(4000);
+
+ /* Success. */
+ return 0;
+}