summaryrefslogtreecommitdiff
path: root/tests/equal1.c
blob: 3b4c7584830b3818af01ad080ca7eaa66d041cb3 (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
#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;
}