mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) 5d1702e01a
: [Backport #20414]
Enumerator should use a non-blocking fiber, change `rb_fiber_new` to be non-blocking by default. (#10481)
This commit is contained in:
parent
5141d72fde
commit
2f8f17e842
3 changed files with 10 additions and 2 deletions
2
cont.c
2
cont.c
|
@ -2339,7 +2339,7 @@ rb_fiber_initialize(int argc, VALUE* argv, VALUE self)
|
||||||
VALUE
|
VALUE
|
||||||
rb_fiber_new_storage(rb_block_call_func_t func, VALUE obj, VALUE storage)
|
rb_fiber_new_storage(rb_block_call_func_t func, VALUE obj, VALUE storage)
|
||||||
{
|
{
|
||||||
return fiber_initialize(fiber_alloc(rb_cFiber), rb_proc_new(func, obj), rb_fiber_pool_default(Qnil), 1, storage);
|
return fiber_initialize(fiber_alloc(rb_cFiber), rb_proc_new(func, obj), rb_fiber_pool_default(Qnil), 0, storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
|
|
@ -42,4 +42,12 @@ class TestFiberEnumerator < Test::Unit::TestCase
|
||||||
assert_predicate(i, :closed?)
|
assert_predicate(i, :closed?)
|
||||||
assert_predicate(o, :closed?)
|
assert_predicate(o, :closed?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def enumerator_fiber_is_nonblocking
|
||||||
|
enumerator = Enumerator.new do |yielder|
|
||||||
|
yielder << Fiber.current.blocking?
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal(false, enumerator.next)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||||
#define RUBY_VERSION_TEENY 4
|
#define RUBY_VERSION_TEENY 4
|
||||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||||
#define RUBY_PATCHLEVEL 178
|
#define RUBY_PATCHLEVEL 179
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
#include "ruby/internal/abi.h"
|
#include "ruby/internal/abi.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue