| 1 |
/* These tests all check whether initialization happens properly even if no |
| 2 |
transaction has been used in the current thread yet. */ |
| 3 |
|
| 4 |
/* { dg-options "-pthread" } */ |
| 5 |
|
| 6 |
#include <stdlib.h> |
| 7 |
#include <pthread.h> |
| 8 |
#include <libitm.h> |
| 9 |
|
| 10 |
static void *test1 (void *dummy __attribute__((unused))) |
| 11 |
{ |
| 12 |
if (_ITM_inTransaction() != outsideTransaction) |
| 13 |
abort(); |
| 14 |
return NULL; |
| 15 |
} |
| 16 |
|
| 17 |
static void *test2 (void *dummy __attribute__((unused))) |
| 18 |
{ |
| 19 |
if (_ITM_getTransactionId() != _ITM_noTransactionId) |
| 20 |
abort(); |
| 21 |
return NULL; |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
int main() |
| 26 |
{ |
| 27 |
pthread_t thread; |
| 28 |
|
| 29 |
pthread_create(&thread, NULL, test1, NULL); |
| 30 |
pthread_join(thread, NULL); |
| 31 |
|
| 32 |
pthread_create(&thread, NULL, test2, NULL); |
| 33 |
pthread_join(thread, NULL); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |