1. Armin Rigo
  2. duhton

Commits

Armin Rigo  committed 7eef65a

Fix the demo, but it still gives nonsense.

  • Participants
  • Parent commits 9c414e6
  • Branches default

Comments (0)

Files changed (1)

File demo/container_transaction.duh

View file
 (setq c (container 0))
 (defun f (n)
     (set c (+ (get c) 1))
-    (if (< n 1000)
-        (transaction f (+ n 1))
-      (if (< (get c) 2000)
-          (print (quote not-enough))
-        (print (quote ok)))))
-(transaction f 0)
-(transaction f 0)
+    (if (> (get c) 2000)
+        (print (quote overflow) (get c))
+      (if (< n 1000)
+          (transaction f (+ n 1))
+        (if (< (get c) 2000)
+            (print (quote not-enough))
+          (print (quote ok))))))
+(transaction f 1)
+(transaction f 1)