def load_bitmap
bitmap = [] # 图片组
threads = []
pages = [] # 数据包(就是一个资源数据包,就用[]代替)
for page_to_fetch in pages
threads << Thread.new(page_to_fetch) do |data|
# 加载数据代码
file = File.open("temp.tem","wb")
file.write(data)
file.close
bitmap.push(Bitmap.new("temp.tem"))
File.delete("temp.tem")
end
end
threads.each {|thread| thread.join }
return bitmap
end
def load_bitmap
bitmap = [] # 图片组
threads = []
pages = [] # 数据包(就是一个资源数据包,就用[]代替)
for page_to_fetch in pages
threads << Thread.new(page_to_fetch) do |data|
# 加载数据代码
file = File.open("temp.tem","wb")
file.write(data)
file.close
bitmap.push(Bitmap.new("temp.tem"))
File.delete("temp.tem")
end
end
threads.each {|thread| thread.join }
return bitmap
end