Source

duhton / demo / list_transaction.duh

Full commit

(setq lst (list 0))
(defun g (n)
    (set lst 0 (+ (get lst 0) 1))
    (if (< n 10)
        (transaction f (+ n 1))
      (sleepms 20)
      (if (< (get lst 0) 20)
          (print (quote not-enough))
        (print (quote ok)))))
(defun f (n)
  (if (defined? marker)
      (print (quote marker-already-defined)))
  (setq marker 0)
  (g n))
(transaction f 1)
(transaction f 1)