Search code examples
clojure

Which is the ideal Clojure concurrency construct for maintaining queue of data to be processed?


If I want to maintain a queue of frames of images on the server side that I will be sending to the client what data structure should I use ?

I am trying to make a simple app where I will send frames to the server and server will then push them to other clients.

should I maintain this queue as an atom or as a ref?


Solution

  • You could just use one of the queue classes from java.util.concurrent. Easy access to the Java standard library is after all one of the strong points of Clojure, so you don't have to build everything yourself from the building blocks provided by Clojure if Java already provides something that does the job.

    I would suggest to choose something from the implementations of the interface BlockingQueue.