Created
February 22, 2010 13:57
-
-
Save naoto/311085 to your computer and use it in GitHub Desktop.
Thread調査
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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