Wednesday 15 August 2012

concurrency - Clojure: Agent calling Agent: suspicion of deadlock? -


Consider the following code:

  (two [slave-agent (agent 0) Run - slave (FN [_] (Printer "Running Slave Agent")) Run-Master (FN [_] (Loop [] (PrintLine "Send to Slave Agent") (Send-Off Slave-Agent Run-Slave ) (Thread / sleep 1000) (recur)) Master-agent (agent blue)] (dispatch master-agent run-master))   

Any combination of sending / send-off Using, I'm a slave-agent Was not. However, when I run Run-Master in classical java.lang. Interesting, everything works fine

There is no one idea.

Regards

Jesse

sending is done, however your run-server never returns. Then you only send stop sending requests that are never actually submitted for execution. Try to do something like this:

  (run-master [_] (sending-slave-agent run-slave) (dispatch-off * agent * run-master) (thread / sleep 1000 )))    

No comments:

Post a Comment