libitm/testsuite/libitm.c/simple-1.c
raw| 1 | /* Verify that two sequential runs of a transaction will complete and |
| 2 | produce correct results. An early test of the library did in fact |
| 3 | leave things in an inconsistent state following the commit of the |
| 4 | first transaction. */ |
| 5 | |
| 6 | #include <stdlib.h> |
| 7 | |
| 8 | static int x; |
| 9 | |
| 10 | static void start (void) |
| 11 | { |
| 12 | __transaction_atomic { x++; } |
| 13 | } |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | start (); |
| 18 | start (); |
| 19 | |
| 20 | if (x != 2) |
| 21 | abort (); |
| 22 | |
| 23 | return 0; |
| 24 | } |