summaryrefslogtreecommitdiff
path: root/libitm/testsuite/libitm.c/simple-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'libitm/testsuite/libitm.c/simple-1.c')
-rw-r--r--libitm/testsuite/libitm.c/simple-1.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libitm/testsuite/libitm.c/simple-1.c b/libitm/testsuite/libitm.c/simple-1.c
new file mode 100644
index 0000000000..de41740d49
--- /dev/null
+++ b/libitm/testsuite/libitm.c/simple-1.c
@@ -0,0 +1,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;
+}