moved from <#C0B8MA7FA|getting-started> Any best...
# coroutines
r
moved from #getting-started Any best practice to implement job queue in Kotlin using coroutines? Here is my code
Copy code
val queue = LinkedBlockingQueue<Note>()
    var closed = false

    init {
        async(CommonPool) {
            while (!closed) {
                while (!closed && queue.isEmpty()) {
                    delay(50)
                }
                while (!closed && !queue.isEmpty()) {
                    play(queue.take())
                }
            }
        }
    }
I don't like
delay(50)
and I think it's not sufficient.
Someone mentioned channels and actors. Let me have a look
e