Does anyone have recommendations for concurrent queue data structures that allow you to remove the tail iff it's equal to some object? Basically allowing you to CAS the tail?
I've been working with the ConcurrentLinkedQueue from the java collections framework, and it kinda works, but the remove method on it doesn't quite match the semantics I want.
I don't have an answer for you but this mailing list is a place where people discuss such things: http://cs.oswego.edu/pipermail/concurrency-interest/
Thanks
you can also use compare-and-swap! directly in clojure
Yeah, although I'm trying to not reimplement a concurrent queue in clojure with atoms
do you need the blocking behavior?
no, I just need to be able to do atomic removal of elements after I inspect them
(of BlockingQueues in j.u.concurrent)
then honestly I'd look at putting a PersistentQueue in an atom, and using cas, not swap
That might be feasible, the main reason I hadn't looked too hard at this is I'm expecting high contention on this queue and so I was looking to j.u.concurrent for mutable implementations to help mitigate that cost.
j.u.c queues don't allow you to atomically peek at the tail of a queue
yes, that was the problem