Feature #5958
Updated by nobu (Nobuyoshi Nakada) almost 6 years ago
=begin I propose the method `ThreadGroup#join`. ThreadGroup#join. Calling thread waits all threads in receiving `threadgroup`. ```ruby threadgroup. thgrp = ThreadGroup.new thgrp.add(Thread.new{ sleep 1 }) thgrp.join #=> #<ThreadGroup:0x007ff257d6d098> ``` Time limit to run the threads in the `threadgroup` threadgroup can be specified. If the time limit expires, nil will be returned. ```ruby 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