The downside of #'thread (just as with send-off) is that it can use
arbitrarily many threads for performing IO ops. And while some IO tasks
benefit from performing them from multiple threads (for fairness, perf),
others don't (e.g. writing to a log, AFAICT). And in no case one wants to
spawn a thou
Eh, you're right, there is however, a blocking version of go, called thread:
So perhaps something like this?
(thread
(while true
(let [[filename response-chan] (!! response-chan (slurp filename)
Or perhaps I'm missing something.
Timothy
On Mon, Jul 8, 2013 at 10:09 AM, vemv wrote:
Took me a while to get the idea but higher-order channels are brilliant -
that way one ensures a given reply was actually targeted at one's request.
Thanks for the suggestion!
Faux-agents would have the limitation of not being to (reasonably) perform
blocking I/O - which is the point of my samp
A few thoughts on ways to improve this code:
Using agents and go blocks in the same code is a bit odd. If you need a
queue plus a process, just do something like this:
(defn faux-agent [c]
(go (loop []
(when-let [msg (! req-chan :req)
do something like this:
(>! req-chan [file-nam