there is a way to subscribe to reference types in clojure via the add-watch function.
you can with wherry little hackering make a call me once function that under the hod whill hock upp and remove the watcher when called this whill not be syncronus butt its easy to do !!!EXAMPLE (get-data-once MY-REF (fn [data] !DO SOMETHING WITH DATA!) !!!END 2010/5/12 Michael Jaaka <michael.ja...@googlemail.com> > Hi! > > Let me tell you my problem: > > I have atom, which is some structure (my hashmap). > > Now periodically some data are assoc to my hashmap with swap! > (producer). > > Also there is a consumer of these added data, which takes the data (in > fact it just re-organize my hashmap, to mark the fact that something > was borrowed/taken). > > Now I would like to make, that consumer blocks when it notices that > there is no data waiting in my hashmap until producer assoc new data > in hashmap. > > Produced data are assoc because they can be "produced" many times, so > linked blocking queue is not allowed as synchronization mechanism. > > I can't find any way to do it in Clojure. In Java I would just do it > with HashMap (not HashSet because I also associate some data with > produced data) and block of synchronize, wait and notify. Any help > there? > > -- > 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<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- ------------------------------------------------------------ Email: patrik.kar...@gmail.com ------------------------------------------------------------ -- 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