зеркало из https://github.com/github/ruby.git
* cont.c (rb_fiber_alive_p): fix to return true instead of 1.
[ruby-dev:37991] * test/ruby/test_fiber.rb: add a test for Fiber#alive? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
03ee5fa027
Коммит
c5d7d78dae
|
@ -1,3 +1,10 @@
|
|||
Fri Feb 13 15:01:40 2009 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* cont.c (rb_fiber_alive_p): fix to return true instead of 1.
|
||||
[ruby-dev:37991]
|
||||
|
||||
* test/ruby/test_fiber.rb: add a test for Fiber#alive?
|
||||
|
||||
Fri Feb 13 09:43:19 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (ac_cv_func_flock): using flock defined in
|
||||
|
|
2
cont.c
2
cont.c
|
@ -933,7 +933,7 @@ rb_fiber_alive_p(VALUE fibval)
|
|||
{
|
||||
rb_fiber_t *fib;
|
||||
GetFiberPtr(fibval, fib);
|
||||
return fib->status != TERMINATED;
|
||||
return fib->status != TERMINATED ? Qtrue : Qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -164,5 +164,14 @@ class TestFiber < Test::Unit::TestCase
|
|||
assert_equal(nil, Thread.current[:v]); fb.resume
|
||||
assert_equal(nil, Thread.current[:v]);
|
||||
end
|
||||
|
||||
def test_alive
|
||||
fib = Fiber.new{Fiber.yield}
|
||||
assert_equal(true, fib.alive?)
|
||||
fib.resume
|
||||
assert_equal(true, fib.alive?)
|
||||
fib.resume
|
||||
assert_equal(false, fib.alive?)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче