view libitm/testsuite/libitm.c/simple-1.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* 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;
}