On Sat, Jan 31, 2009 at 8:01 AM, wubbie <sunj...@gmail.com> wrote: > > Hello, > I'd like to separate dosync and other funcs as follows. > Any comment? Essentially I want to allow more concurrency. > > (if true > (do > (dosync (ref-set r1 1)) > (non-ref setting fun)) > (else-fun)) > > Instead of > (if true > (dosync > (ref-set r1 1) > (non-ref setting fun)) > (else-fun))
Sure you can, at least it looks ok without having more detail about your various functions. It's good to reduce the scope of a transaction as much as possible, while keeping large enough to be correct. One thing I'd be careful about is the use of 'ref-set' there. In a real program it seems rare that a 'ref-set' would stand alone like that. I'd check carefully to see if the 'dosync' needs to include the 'if's test expression as well. --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---