Thread.new { ... } â thread
Thread.new(*args, &proc) â thread
Thread.new(*args) { |args| ... } â thread
Thread.new(*args, &proc) â thread
Thread.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, be sure
to call super in your initialize method, otherwise a ThreadError will be raised.
Please login to continue.