aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libitm/testsuite/libitm.c/simple-1.c
blob: de41740d49af44f2eaa8c33a96e365a557120b38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Verify that two sequential runs of a transaction will complete and
   produce correct results.  An early test of the library did in fact
   leave things in an inconsistent state following the commit of the
   first transaction.  */

#include <stdlib.h>

static int x;

static void start (void)
{
  __transaction_atomic { x++; }
}

int main()
{
  start ();
  start ();

  if (x != 2)
    abort ();

  return 0;
}