Edit: Mine has a minor bug: The conditional in eat should be inside
the same dosync as the result, so it should be:
(if (not (dosync (let [first-fork @(nth...) second-fork @(nth...)]
(if (and first-fork second-fork)
(do (ref-set ...) (ref-set ...)))
(and first-fork second-fork)))
(eat i))
Where the unchanged code is elided. Sorry about the confusion, if
there was any. This actually fixes the even subtler nested dosync
problem, which should have led to a degradation in concurrency, but I
couldn't see it in the printout.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en