blob: d882adc977edf8c5ef9f685aaf53e014b38f1828 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*
* Test for pthread_equal.
*
* Depends on functions: pthread_create().
*/
#include <pthread.h>
#include <stdio.h>
#include <windows.h>
void * func(void * arg)
{
Sleep(2000);
return 0;
}
main()
{
int rc;
pthread_t t1, t2;
if (pthread_create(&t1, NULL, func, (void *) 1) != 0)
{
return 1;
}
if (pthread_create(&t2, NULL, func, (void *) 2) != 0)
{
return 1;
}
if (pthread_equal(t1, t2))
{
return 1;
}
if (pthread_equal(t1,t1) == 0)
{
return 1;
}
/* This is a hack. We don't want to rely on pthread_join
yet if we can help it. */
Sleep(8000);
/* Success. */
return 0;
}
|