I think `ports.each` might make more sense here.  Something like:

```ruby
threads = []
ports.each do |port|
  if threads.length >= datastore['CONCURRENCY']
    # Assume the first thread will be among the earliest to finish
    threads.first.join
  end
  # Create new thread for this port
  # ...
end
```