Skip to content

Instantly share code, notes, and snippets.

@hiremaga
Created June 30, 2013 23:39
Show Gist options
  • Save hiremaga/5897486 to your computer and use it in GitHub Desktop.
Save hiremaga/5897486 to your computer and use it in GitHub Desktop.
A spike to demostrate the thread (un)safety of autoload, stolen from somwhere I can't remember
sleep 1
Bar::Foo = 1
module Bar
autoload :Foo, 'autoloaded.rb'
end
t1 = Thread.new { Bar::Foo }
t2 = Thread.new { Bar::Foo }
t1.join; t2.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment