summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/atomicinc.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rts/atomicinc.c')
-rw-r--r--testsuite/tests/rts/atomicinc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/rts/atomicinc.c b/testsuite/tests/rts/atomicinc.c
new file mode 100644
index 0000000000..9e250f30f0
--- /dev/null
+++ b/testsuite/tests/rts/atomicinc.c
@@ -0,0 +1,19 @@
+#include "Rts.h"
+
+StgWord i;
+
+int main(int argc, char *argv[])
+{
+ StgWord j;
+
+ i = 0;
+ j = atomic_inc(&i,1);
+ CHECK(j == 1);
+ CHECK(i == 1);
+
+ j = atomic_dec(&i);
+ CHECK(j == 0);
+ CHECK(i == 0);
+
+ return 0;
+}