I'm preparing a presentation about asynchronous concurrency in Clojure, and I'm planning on talking a bit about how Clojure's constructs make good, sensible use of Java's concurrency libraries. My question is about clojure.lang.Agent. In the doRun method, I'm missing what prevents a race condition in the updating of the agent's state variable.
This code in doRun seems to be a classic read-and-write operation: Object oldval = action.agent.state; Object newval = action.fn.applyTo( RT.cons(action.agent.state, action.args)); action.agent.setState(newval); doRun is not synchronized. As far as I can tell, Executors don't synchronize the execution of runnable objects. What am I missing? BTW, I have to say, it's really fun to read the Java code in src/jvm/ clojure. Cheers, Michael -- 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 Note that posts from new members are moderated - please be patient with your first post. 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