status

thr.status â string, false or nil
Instance Public methods

Returns the status of thr: âsleep'' if thr is sleeping or waiting on I/O, ârun'' if thr is executing, âaborting'' if thr is aborting, false if thr terminated normally, and nil if thr terminated with an exception.

a = Thread.new { raise("die now") }
b = Thread.new { Thread.stop }
c = Thread.new { Thread.exit }
d = Thread.new { sleep }
d.kill                  #=> #<Thread:0x401b3678 aborting>
a.status                #=> nil
b.status                #=> "sleep"
c.status                #=> false
d.status                #=> "aborting"
Thread.current.status   #=> "run"
doc_ruby_on_rails
2015-05-17 14:19:47
Comments
Leave a Comment

Please login to continue.