Skip to content

Instantly share code, notes, and snippets.

@davydovanton
Last active February 4, 2016 06:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davydovanton/5c1b9255bf2e5634c143 to your computer and use it in GitHub Desktop.
Save davydovanton/5c1b9255bf2e5634c143 to your computer and use it in GitHub Desktop.
# 1. Какой результат будет в MRI, Jruby, rubinius при выполнении следующего кода?
# Почему так происходит. Как можно улучшить данный код.
array = []
10.times do
Thread.new do
10.times { array << nil }
end
end
array.size
# 2. Что произойдет в mri если http://somesite.org будет не доступен?
require 'open-uri'
3.times.map do
Thread.new do
open('http://somesite.org')
end
end.each(&:value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment