Quote (carteblanche @ Mar 31 2013 11:00am)
Sorry it was unspecific. Basically I have a work queue that holds computationally intensive queue. Each loop iteration removes from the top of the queue and gives it to a new thread to finish.
However, I want to limit the number of threads that run at the same time, so I want to prevent the thread spawner from continuing until AT LEAST ONE thread finishes and only let it continue after a thread finishes. So if !(threadsRunning < THREAD_RUNNING_THRESHOLD) then sit there and wait until a thread says it's done.
It looks like I'm gonig to want to use a Condition for that, but that also is related to Lock, and for what I'm doing, a lock isn't needed. (Or maybe it is and I have no clue what I'm doing? Maybe! Dx)
But really I'm not sure what structure specifically is desirable for this. I'm pretty sure I want to use something in java.util.concurrent, but I'm very unknowledgable with those, so I'm just lost

Basically something like an event listener would suffice, but I don't know what structure has something like that.
This post was edited by Godel on Mar 31 2013 02:17pm