Issue #5958 has been updated by Masaki Matsushita. =begin Without ThreadGroup#join, we have to get list of threads and join each thread in the ThreadGroup. thgrp = ThreadGroup.new 3.times do |i| thgrp.add(Thread.new{ sleep i+1 }) end thgrp.list.each(&:join) Moreover, it is confusing to set limit on joining in the situation. class ThreadGroup def join(delay=nil) if delay limit = Time.now + delay if self.list.all?{|th| th.join(limit - Time.now.to_f) } return self else return nil end else self.list.each(&:join) return self end end end ThreadGroup#join enables to join threads as a unit of ThreadGroup. I think ThreadGroup will be more useful if it provides methods to manipulate its own threads like this. =end ---------------------------------------- Feature #5958: ThreadGroup#join https://bugs.ruby-lang.org/issues/5958 Author: Masaki Matsushita Status: Open Priority: Normal Assignee: Category: core Target version: =begin I propose the method ThreadGroup#join. Calling thread waits all threads in receiving threadgroup. thgrp = ThreadGroup.new thgrp.add(Thread.new{ sleep 1 }) thgrp.join #=> #<ThreadGroup:0x007ff257d6d098> Time limit to run the threads in the threadgroup can be specified. If the time limit expires, nil will be returned. thgrp = ThreadGroup.new thgrp.add(Thread.new{}) thgrp.add(Thread.new{ sleep }) thgrp.join(0.1) #=> nil I think it is useful to wait grouped threads together. =end -- http://bugs.ruby-lang.org/