Just a quick thought (and before I've had my coffee no less!), but I
think what I'd do is replace the boolean *end-search* with a
*search-state* var that could be either :idle, :running or :stopping.
Then in search-stops, just set *search-state* to :stopping -- you
don't need to actually wait for the agents to finish, you just need to
know that the current condition is "waiting for the search to end" so
you don't quit the app or start a new search until the cleanup is
finished. Then when you do hit some task that needs to wait until the
agents are done, you can go ahead and await the agents (i.e. if you're
quitting and it doesn't matter if there's a hang), or spawn a thread
that will await the agents before starting the new search. You could
also run a cleanup thread that would check the state of your search
agents and set the *search-state* from :stopping back to :idle once
all the search agents had finished.

Mark

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