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))) > This is a bad idea if you're ever going to redefine the function (at the REPL). Your new definition will end up using a different lock even though they both "look" the same. -- 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