OSDN Git Service

Enable to track git://github.com/monaka/binutils.git
[pf3gnuchains/pf3gnuchains3x.git] / winsup / testsuite / winsup.api / pthread / equal1.c
1 /*
2  * Test for pthread_equal.
3  *
4  * Depends on functions: pthread_create().
5  */
6
7 #include "test.h"
8
9 void * func(void * arg)
10 {
11   Sleep(2000);
12   return 0;
13 }
14
15 int 
16 main()
17 {
18   pthread_t t1, t2;
19
20   assert(pthread_create(&t1, NULL, func, (void *) 1) == 0);
21
22   assert(pthread_create(&t2, NULL, func, (void *) 2) == 0);
23
24   assert(pthread_equal(t1, t2) == 0);
25
26   assert(pthread_equal(t1,t1) != 0);
27
28   /* This is a hack. We don't want to rely on pthread_join
29      yet if we can help it. */
30    Sleep(4000);
31
32   /* Success. */
33   return 0;
34 }