On Sun, Feb 8, 2009 at 12:23 PM, Anand Patil < anand.prabhakar.pa...@gmail.com> wrote:
> > Hello again, > > In my application, I'll frequently want to quickly discard all the > changes made during a transaction involving many refs. I don't want to > force the refs to roll back to their values at the beginning of the > transaction, I just want to end the transaction immediately and skip > the write stage; updates made in other transactions should still > 'stick'. What's the most efficient way to do this? > > Thanks again! > Anand Refs don't roll back their values to the beginning of the transaction. Let say I'm moving money from account A to Account B. Account B has $1000 at the beginning of the transaction. I'm taking $200 from account A and put it into account B. Therefore at the end of my transaction account be should have $1200. However, when the transaction tries to put this result into B it discovers that it has now $1500 in it. This mean that another transaction changed the value first. I clearly can't overwrite this with $1200 otherwise some money would have disappeared! So the STM decide the transaction actually never took place. It doesn't revert B to the beginning of the transaction it just forgot it computed $1200. So the transaction is restarted. This time, it finds out account B should have $1700. If account B still have $1500 then its value will be updated. The STM probably already work as you'd wish. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---