[testsuite] Fix retrieval of testname
[official-gcc.git] / libitm / testsuite / libitm.c / notx.c
blob7ca6580452bef5e9a5c110942e3a3915aec34591
1 /* These tests all check whether initialization happens properly even if no
2 transaction has been used in the current thread yet. */
4 /* { dg-options "-pthread" } */
6 #include <stdlib.h>
7 #include <pthread.h>
8 #include <libitm.h>
10 static void *test1 (void *dummy __attribute__((unused)))
12 if (_ITM_inTransaction() != outsideTransaction)
13 abort();
14 return NULL;
17 static void *test2 (void *dummy __attribute__((unused)))
19 if (_ITM_getTransactionId() != _ITM_noTransactionId)
20 abort();
21 return NULL;
25 int main()
27 pthread_t thread;
29 pthread_create(&thread, NULL, test1, NULL);
30 pthread_join(thread, NULL);
32 pthread_create(&thread, NULL, test2, NULL);
33 pthread_join(thread, NULL);
35 return 0;