mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
remove Ractor#close
close_incoming by antoher ractor means there is no other messages will be sent to the ractor, so Ractor.receive will block forever, and it should raise and stop. close_outgoing by antoher ractor means, ... I don't have good idea to use it. It can be a private method. Ractor#close calls both, but it does not make sense to call different purpose methods, so I remove it.
This commit is contained in:
parent
deed21bb08
commit
fa3670e6e4
Notes:
git
2020-11-11 18:11:33 +09:00
2 changed files with 2 additions and 10 deletions
|
@ -201,8 +201,8 @@ assert_equal 'ok', %q{
|
||||||
# Raise Ractor::ClosedError when try to send into a closed actor
|
# Raise Ractor::ClosedError when try to send into a closed actor
|
||||||
assert_equal 'ok', %q{
|
assert_equal 'ok', %q{
|
||||||
r = Ractor.new { Ractor.receive }
|
r = Ractor.new { Ractor.receive }
|
||||||
|
r.close_incoming
|
||||||
|
|
||||||
r.close
|
|
||||||
begin
|
begin
|
||||||
r.send(1)
|
r.send(1)
|
||||||
rescue Ractor::ClosedError
|
rescue Ractor::ClosedError
|
||||||
|
@ -219,7 +219,7 @@ assert_equal 'ok', %q{
|
||||||
Ractor.receive
|
Ractor.receive
|
||||||
end
|
end
|
||||||
|
|
||||||
r.close
|
r.close_outgoing
|
||||||
begin
|
begin
|
||||||
r.take
|
r.take
|
||||||
rescue Ractor::ClosedError
|
rescue Ractor::ClosedError
|
||||||
|
|
|
@ -164,14 +164,6 @@ class Ractor
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Closes both incoming and outgoing ports.
|
|
||||||
def close
|
|
||||||
close_incoming
|
|
||||||
close_outgoing
|
|
||||||
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
# utility method
|
# utility method
|
||||||
def self.shareable? obj
|
def self.shareable? obj
|
||||||
__builtin_cexpr! %q{
|
__builtin_cexpr! %q{
|
||||||
|
|
Loading…
Add table
Reference in a new issue