Skip to content

Instantly share code, notes, and snippets.

@matsubo
Last active December 14, 2015 03:39
Show Gist options
  • Save matsubo/5022995 to your computer and use it in GitHub Desktop.
Save matsubo/5022995 to your computer and use it in GitHub Desktop.
% ruby thread.rb
#!/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