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]
This commit is contained in:
parent
e271a3d4af
commit
fc83b4896e
Notes:
git
2021-02-11 00:56:25 +09:00
10
thread.c
10
thread.c
@ -3213,8 +3213,7 @@ rb_thread_report_exc_set(VALUE thread, VALUE val)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* thr.group -> thgrp or nil
|
* thr.group -> thgrp or nil
|
||||||
*
|
*
|
||||||
* Returns the ThreadGroup which contains the given thread, or returns +nil+
|
* Returns the ThreadGroup which contains the given thread.
|
||||||
* if +thr+ is not a member of any group.
|
|
||||||
*
|
*
|
||||||
* Thread.main.group #=> #<ThreadGroup:0x4029d914>
|
* Thread.main.group #=> #<ThreadGroup:0x4029d914>
|
||||||
*/
|
*/
|
||||||
@ -3222,8 +3221,7 @@ rb_thread_report_exc_set(VALUE thread, VALUE val)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_thread_group(VALUE thread)
|
rb_thread_group(VALUE thread)
|
||||||
{
|
{
|
||||||
VALUE group = rb_thread_ptr(thread)->thgroup;
|
return rb_thread_ptr(thread)->thgroup;
|
||||||
return group == 0 ? Qnil : group;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
@ -4974,10 +4972,6 @@ thgroup_add(VALUE group, VALUE thread)
|
|||||||
rb_raise(rb_eThreadError, "can't move to the enclosed thread group");
|
rb_raise(rb_eThreadError, "can't move to the enclosed thread group");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target_th->thgroup) {
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OBJ_FROZEN(target_th->thgroup)) {
|
if (OBJ_FROZEN(target_th->thgroup)) {
|
||||||
rb_raise(rb_eThreadError, "can't move from the frozen thread group");
|
rb_raise(rb_eThreadError, "can't move from the frozen thread group");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user