Project

General

Profile

Actions

Feature #5958

closed

ThreadGroup#join

Added by Glass_saga (Masaki Matsushita) about 12 years ago. Updated almost 5 years ago.

Status:
Rejected
Target version:
-
[ruby-core:42311]

Description

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.


Files

patch.diff (2.38 KB) patch.diff Glass_saga (Masaki Matsushita), 02/01/2012 11:19 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #15954: 簡単にマルチスレッドを一度に合流させるRejectedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0