On Sat, Oct 31, 2009 at 12:36 PM, Luke VanderHart <luke.vanderh...@gmail.com
> wrote:

> Why not just run an agent that does something, then calls sleep for N
> seconds, then calls the next thing?
>
> Granted, it will eat up a thread in your agent thread pool, but if
> you've only got one of these in the app it shouldn't be a problem.
>
> Or you could go the Java route, and start a daemon thread manually.


Or you could use send-off instead of send; send-off doesn't consume from a
finite thread pool and is thus suitable for long-running (or blocking, e.g.
I/O) tasks.

Incidentally, if you ever want to simply reset the state of an agent to a
particular value, analogously to ref-set and reset!, this can work:

(defn set-agent [a v] (send a (fn [_] v)))

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to