Bug #17505
closed
Can `Thread#group` actually be `nil`?
Added by marcandre (Marc-Andre Lafortune) almost 4 years ago.
Updated almost 4 years ago.
Description
Is there a circumstance where Thread#group
could actually be nil
?
The documentation says so, there seems to be source code for this, but I can find no test or RubySpec for this and I don't see anywhere in the ThreadGroup
API that could allow this.
- Status changed from Open to Closed
Applied in changeset git|fc83b4896e9d7de084b203b133b84c1209c6ad88.
Don't document that Thread#group can return nil
Thread's are assigned a group at initialization, and no API exists
for them to unassign them from a group without assigning them to
another group.
Fixes [Bug #17505]
Just FYI
Japanese documents says
死んでいるスレッドは nil を返します。
Dead thread's group returns nil
from 1.8.0 to 1.9.0-0.
% docker run -it --rm ghcr.io/ruby/all-ruby env ALL_RUBY_SINCE=ruby-1.8 ./all-ruby -e 'th=Thread.start{};Thread.pass;p th.group.class'
ruby-1.8.0 NilClass
...
ruby-1.9.0-0 NilClass
ruby-1.9.0-1 ThreadGroup
...
ruby-3.0.0 ThreadGroup
Perfect, so this confirms the spec has changed a long time ago 👍
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0