status() public

Returns the status of thr.


Returned if this thread is sleeping or waiting on I/O


When this thread is executing


If this thread is aborting


When this thread is terminated normally


If 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"

See also the instance methods #alive? and #stop?

Show source
Register or log in to add new notes.