1 /* Simplest test involving real threads.  Verify we get the correct answer.  */
2 
3 /* { dg-options "-pthread" } */
4 
5 #include <stdlib.h>
6 #include <pthread.h>
7 
8 static int x;
9 
start(void * dummy)10 static void *start (void *dummy __attribute__((unused)))
11 {
12   __transaction_atomic { x++; }
13   return NULL;
14 }
15 
main()16 int main()
17 {
18   pthread_t p[10];
19   int i;
20 
21   for (i = 0; i < 10; ++i)
22     pthread_create (p+i, NULL, start, NULL);
23 
24   for (i = 0; i < 10; ++i)
25     pthread_join  (p[i], NULL);
26 
27   if (x != 10)
28     abort ();
29 
30   return 0;
31 }
32