Skip to content

Instantly share code, notes, and snippets.

@naoto
Created February 22, 2010 13:57
Show Gist options
  • Save naoto/311085 to your computer and use it in GitHub Desktop.
Save naoto/311085 to your computer and use it in GitHub Desktop.
Thread調査
class Hoge
def fuga
loop do
for i in 1..10
puts "fuga: #{Time.now.instance_eval { '%s.%03d' % [strftime('%Y%m%d%H%M%S'), (usec / 1000.0).round] }}"
end
sleep 5
end
rescue
puts "Hoge::fuga Dead"
end
def priv
puts "priv: #{Time.now.instance_eval { '%s.%03d' % [strftime('%Y%m%d%H%M%S'), (usec / 1000.0).round] }}"
end
end
hoge = Hoge.new
t = Thread.new {
hoge.fuga
}
loop do
hoge.priv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment