I want to have an array of threads[] such that if a thread is "free" or not working on any program then it will be assigned a new task.
Is there anyway to check if a thread in ruby is "free". Currently I used
if (threads[thread_id].nil? || !threads[thread_id].status)
# yes thread is free
But doesn't seem to be correct way, some thread still override working other.