Yeah, I used to do that, but once core.async came out I started to desire
the back pressure aspects of channels. I don't think I've used agents for
logging since. You always run the risk of something backing up the queue of
the agent and causing your thread to crash when it runs out of memory.

On Thu, Oct 13, 2016 at 8:04 PM, Mark Engelberg <mark.engelb...@gmail.com>
wrote:

> I always found it a bit ironic that my main use case for agents doesn't
> really at all make use of the "mutable ref" aspect of the agent, only the
> queue piece.  I usually hold the name of the log file in the mutable ref to
> emphasize that the agent is "guarding" this particular log file, but I
> don't actually mutate it, so the mutability doesn't really matter for this
> purpose.
>
> On Thu, Oct 13, 2016 at 7:02 PM, Mark Engelberg <mark.engelb...@gmail.com>
> wrote:
>
>> My primary use case for agents has always been when I want to coordinate
>> multiple threads writing to a log file.  The agent effectively serializes
>> all the write requests with a minimum of fuss.
>>
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to