On Wed, Mar 2, 2011 at 6:49 PM, Daniel Solano Gomez <cloj...@sattvik.com> wrote: > On Wed Mar 2 15:44 2011, clj123123 wrote: >> In a multi thread app, is there a way to mark a function to be >> blocking so it can run not simultaneously but would be blocking for >> each thread? > > You could try the locking macro. For this you need an object to lock > on. I suppose you could lock on the function itself: > > (defn my-fn [] > (locking my-fn > (do cool stuff)))
Is there a reason to enforce strict mutual exclusion instead of, say, using a transaction? Perhaps you're doing I/O? You may want to use agents instead in that case. -- 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