Last active
December 14, 2015 03:39
-
-
Save matsubo/5022995 to your computer and use it in GitHub Desktop.
% ruby thread.rb
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
#!/bin/env ruby | |
require 'net/http' | |
require 'uri' | |
# | |
t = [] | |
10.times() { |i| | |
t << Thread.new do | |
5.times { |j| | |
url = sprintf('http://matsu.teraren.com/blog/page/%d/', i * 10 + j) | |
puts url | |
response = Net::HTTP.get URI.parse(url) | |
} | |
end | |
} | |
t.each() {|t| | |
t.join | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment