#encoding:utf-8
require 'net/http'
require 'thread'
require 'open-uri'
queue = Queue.new
threads = []
def get_html(url)
open(url) do |f|
#为什么没有执行到这边呢?
puts f.read
end
end
#add work to the queue
queue<<"http://www.cnblogs.com"
10.times do
threads<
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
解决办法:
在末尾加上