[testsuite] Fix retrieval of testname
[official-gcc.git] / libitm / testsuite / libitm.c / simple-2.c
blobc77d75dcf5160fc7964b8759bfe0060437c77f03
1 /* Simplest test involving real threads. Verify we get the correct answer. */
3 /* { dg-options "-pthread" } */
5 #include <stdlib.h>
6 #include <pthread.h>
8 static int x;
10 static void *start (void *dummy __attribute__((unused)))
12 __transaction_atomic { x++; }
13 return NULL;
16 int main()
18 pthread_t p[10];
19 int i;
21 for (i = 0; i < 10; ++i)
22 pthread_create (p+i, NULL, start, NULL);
24 for (i = 0; i < 10; ++i)
25 pthread_join (p[i], NULL);
27 if (x != 10)
28 abort ();
30 return 0;