Does anyone know a *non blocking* data structure/a...
# kovenant
m
Does anyone know a non blocking data structure/approach that allows to pass only a fixed amount of processes/tasks at any given time? A use case for this is e.g. on Android where I want to resize images. Due to memory constraints only a fixed amount of resizes should be processed concurrently. But naturally I do want to be able to create all the promises in advance. The thing I'm fiddling around with right now is using two `AtomicInteger`s, a head and a tail. By incrementing the head for new tasks and incrementing the tail for finished tasks I have a delta that says something about the number of concurrent tasks. Now this is mainly an idea in my head of which I'm not certain it will work. I'm probably not the only one who has ever thought about this. So any thoughts?