I'm wondering if the following pattern is safe or not. I'm in a
transaction, and I want to create an agent and then send it an initializing
message (the message function isn't transaction-safe, so I don't want to run
it in the transaction). So I want to do something like:
(def my-ref (ref nil))
(defn example [ f ]
(dosync
(if (nil? @my-ref)
(let [ a (agent nil) ]
(ref-set my-ref a)
(send a init-function)
(send a f))
(send @my-ref f))))
(actually, what I want to do is rather more complicated than this, but this
demonstrates the problem). So, my question is: is it guaranteed that
init-function will be received by the agent before any f functions are
received?
Brian
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en