From: "Skye Shaw!@#$" Date: 2007-12-31T14:49:59+09:00 Subject: Re: Why not call Thread.join? On Dec 30, 9:02 pm, thefed wrote: > Take this code from the Ruby Cookbook: > > module Enumerable >    def each_simultaneously >      threads = [] >      each { |e| threads << Thread.new { yield e } } >      return threads >    end > end > > It is used on an array so that you may do this: > [1,2,3].each_simultaneously do |i| >         sleep 5 >         puts i > end > > And it works! What did you expect to happen? The example you provided will do nothing but create threads and exit. > But why don't I need to call threads.each {|t| t.join }? Any running threads are killed when the program exits. > And if I did, would it slow it down? Generally speaking, the only thing it would slow down (stop really) is the execution path of the main thread. Now if for some reason your main thread has to do other work, a join would delay that, of course.