list() public

Returns an array of Thread objects for all threads that are either runnable or stopped.

   Thread.new { sleep(200) }
   Thread.new { 1000000.times {|i| i*i } }
   Thread.new { Thread.stop }
   Thread.list.each {|t| p t}

produces:

   #<Thread:0x401b3e84 sleep>
   #<Thread:0x401b3f38 run>
   #<Thread:0x401b3fb0 sleep>
   #<Thread:0x401bdf4c run>
Show source
Register or log in to add new notes.