Thread.new { ... } â threadThread.new(*args, &proc) â threadThread.new(*args) { |args| ... } â thread
Class Public methods
Creates a new thread executing the given block.
Any args given to ::new
will be passed to the block:
arr = []
a, b, c = 1, 2, 3
Thread.new(a,b,c) { |d,e,f| arr << d << e << f }.join
arr #=> [1, 2, 3]
A ThreadError exception is raised if ::new is called without a block.
If you're going to subclass Thread,