simple-1.c 415 B

12345678910111213141516171819202122232425
  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. #include <stdlib.h>
  6. static int x;
  7. static void start (void)
  8. {
  9. __transaction_atomic { x++; }
  10. }
  11. int main()
  12. {
  13. start ();
  14. start ();
  15. if (x != 2)
  16. abort ();
  17. return 0;
  18. }