[cl-stm-devel] Counter example

Hey folks, Transactions can be parametrized by other transactions. For testing purposes we may want a transaction to pause for two seconds after its calculation. We can define a higher order transaction that does this: (deftransaction sleep-after (seconds transaction) transaction (trans (sleep seconds))) With the counter example loaded (the source can be found in src/examples/counter.lisp) we can now see what happens when two transactions conflict. STM> (defvar *counter* (new 'counter)) *COUNTER* STM> (progn (perform (sleep-after 2 (increment *counter*))) (perform (sleep-after 2 (increment *counter*)))) [debugging output elided...] STM> (value-of (count-of *counter*)) 2 STM> If you looked at the debugging output you would see one of the transactions has retried due to an inconsistent log. I'm sorry that I haven't been posting regularly, but I've been making steady progress. I'm managing to work on it, however small everyday. I'll be posting more regularly this week with snippets like these. Hoan
participants (1)
-
Hoan Ton-That