method

new

v1_8_7_72 - Show latest stable - Class: Thread
new(...)
public

Creates and runs a new thread to execute the instructions given in block. Any arguments passed to Thread::new are passed into the block.

   x = Thread.new { sleep 0.1; print "x"; print "y"; print "z" }
   a = Thread.new { print "a"; print "b"; sleep 0.2; print "c" }
   x.join # Let the threads finish before
   a.join # main thread exits...

produces:

   abxyzc