Last active
August 29, 2015 14:07
-
-
Save toretore/effc9c344cde4e1c8cd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
queues = Array.new(10){ Queue.new } | |
list_of_hosts.each_slice(10).map{|s| s.each_with_index{|h,i| queues[i] << h } } | |
threads = 10.times.map do |i| | |
Thread.new do | |
while host = queues[i].pop | |
check host | |
end | |
end | |
end | |
threads.each(&:join) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment