зеркало из https://github.com/github/ruby.git
* cont.c (rb_fiber_resume): raise an "double resume" error when root
fiber is going to be resumed. [ruby-dev:42523] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5098e6f7df
Коммит
a9afb7e5c6
|
@ -1,3 +1,8 @@
|
|||
Thu Nov 4 02:04:25 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* cont.c (rb_fiber_resume): raise an "double resume" error when root
|
||||
fiber is going to be resumed. [ruby-dev:42523]
|
||||
|
||||
Wed Nov 3 14:17:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/ostruct.rb (OpenStruct#delete_field): also undefine
|
||||
|
|
2
cont.c
2
cont.c
|
@ -1292,7 +1292,7 @@ rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
|
|||
rb_fiber_t *fib;
|
||||
GetFiberPtr(fibval, fib);
|
||||
|
||||
if (fib->prev != Qnil) {
|
||||
if (fib->prev != Qnil || fib->cont.type == ROOT_FIBER_CONTEXT) {
|
||||
rb_raise(rb_eFiberError, "double resume");
|
||||
}
|
||||
|
||||
|
|
|
@ -189,5 +189,13 @@ class TestFiber < Test::Unit::TestCase
|
|||
f1.transfer
|
||||
}, '[ruby-dev:40833]'
|
||||
end
|
||||
|
||||
def test_resume_root_fiber
|
||||
assert_raise(FiberError) do
|
||||
Thread.new do
|
||||
Fiber.current.resume
|
||||
end.join
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче