try lamina? https://github.com/ztellman/lamina/
On Sat, Jun 16, 2012 at 9:44 AM, Warren Lynn <wrn.l...@gmail.com> wrote: > > What I want to do is something I probably have done dozens of times in C++: > two threads, one thread putting items in a queue, another taking it out > (FIFO). How to do it in Clojure? I am at a loss. I thought about a few > options: > > 1. "watches", but it cannot change the queue itself (can only watch). plus, > I am not sure watch function will run in another thread > 2. "agent", but how to notify the consumer thread when there is new item? > How to block the consumer thread when there is no items in the queue? > 3. Ping-pong promises: so the producer delivers a promise to the consumer, > and the consumer immediately deliver another promise to the producer to > acknowledge the receipt so the producer can move on. But that will prevent > the producer to put the next item into the queue before the consumer finish > its processing, so not exactly concurrent. > > I cannot believe I am the first one to encounter this. Can anyone suggest > some idiomatic solution for the above? Thank you. > > > > -- > 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 -- Zhitong He Sun Yat-sen University -- 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