I have the following scenario:
 - a server that is listening on a socket for incoming connections.
 - when the server accepts a connection it uses send-off to run a
handler function to handle the connection
  - the handler function loops using recur to handle packets
  - the handler function uses send-off for some packets so it can
render a gui

I know now that this won't work because when code running in an agent
uses send or send-off, those sends are not dispatched until the agent
changes state (ie, when the function returns).  Because I am looping
in my handler, none of its send-offs work.

Would it be a good rule of thumb to say "agents should not use recur,
but instead should use send-off to re-schedule themselves"?
Is this a performance impact? (ie, recur vs send-off)
Why are sends held until the agent state changes?  Is it a technical
reason, or a conceptual one?

Cheers,
Brad
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to