Hah! Can anyone confirm I'm not daydreaming, and that this actually works? https://gist.github.com/934781 I ended up using an ad hoc, informally-specified, bug-ridden, slow implementation of half of BlockingQueue, but it seems to work /all the time!/
On Apr 22, 9:08 pm, Pepijn de Vos <pepijnde...@gmail.com> wrote: > Hey, > > I was using seque with a BlockingQueue instead of an integer, when I noticed > it does not work for PriorityBlockingQueue and SynchronousQueue. > > I submitted a bug[1] and started a new implementation[2] to work around the > problems, but there is a whole concurrency jungle out there as soon as you > leave persistent data structures behind. > > So the thing is, poll, peek and locking do not work for SynchronousQueue and > poisoning the queue does not work for PriorityBlockingQueue because the > sorting going on. > > I'm currently interrupting the consumer when we're done, like here[3]. It > works most of the time, but sometimes it still hangs. I checked that > interrupting works when it happens before as well as during the .take, so I > can't see how it would hang. > > I could really use some help making this work, because I'm stuck and out of > ideas. > > I devised this form to test it repeatedly and manually (.interrupt cur) later. > > (future (def cur (Thread/currentThread)) (reduce (partial merge-with +) (map > #(dissoc % :type) (repeatedly 100 #(run-tests 'test))))) > > [1]http://dev.clojure.org/jira/browse/CLJ-776 > [2]https://gist.github.com/934781 > [3]http://stackoverflow.com/questions/5378391/closing-a-blocking-queue > > Groeten, > Pepijn de Vos > -- > Sent from my iPod Shufflehttp://pepijndevos.nl -- 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