mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ignore yield_atexit if outgoing port is closed
If outgoing_port is closed, Ractor.yield never successes. [Bug #17310]
This commit is contained in:
parent
db31ace934
commit
deed21bb08
Notes:
git
2020-11-11 18:11:17 +09:00
2 changed files with 14 additions and 0 deletions
|
@ -309,6 +309,16 @@ assert_equal 'ok', %q{
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# a ractor with closed outgoing port should terminate
|
||||||
|
assert_equal 'ok', %q{
|
||||||
|
Ractor.new do
|
||||||
|
close_outgoing
|
||||||
|
end
|
||||||
|
|
||||||
|
true until Ractor.count == 1
|
||||||
|
:ok
|
||||||
|
}
|
||||||
|
|
||||||
# multiple Ractors can receive (wait) from one Ractor
|
# multiple Ractors can receive (wait) from one Ractor
|
||||||
assert_equal '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]', %q{
|
assert_equal '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]', %q{
|
||||||
pipe = Ractor.new do
|
pipe = Ractor.new do
|
||||||
|
|
4
ractor.c
4
ractor.c
|
@ -1288,6 +1288,10 @@ ractor_create(rb_execution_context_t *ec, VALUE self, VALUE loc, VALUE name, VAL
|
||||||
static void
|
static void
|
||||||
ractor_yield_atexit(rb_execution_context_t *ec, rb_ractor_t *cr, VALUE v, bool exc)
|
ractor_yield_atexit(rb_execution_context_t *ec, rb_ractor_t *cr, VALUE v, bool exc)
|
||||||
{
|
{
|
||||||
|
if (cr->outgoing_port_closed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT_ractor_unlocking(cr);
|
ASSERT_ractor_unlocking(cr);
|
||||||
|
|
||||||
struct rb_ractor_basket basket;
|
struct rb_ractor_basket basket;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue