[前][次][番号順一覧][スレッド一覧]

ruby-changes:63582

From: Koichi <ko1@a...>
Date: Wed, 11 Nov 2020 18:11:28 +0900 (JST)
Subject: [ruby-changes:63582] fa3670e6e4 (master): remove Ractor#close

https://git.ruby-lang.org/ruby.git/commit/?id=fa3670e6e4

From fa3670e6e48a8553ad1f37bbfbd112911da497d1 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Wed, 11 Nov 2020 16:15:04 +0900
Subject: 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.

diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 0720c01..7101964 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -201,8 +201,8 @@ assert_equal 'ok', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_ractor.rb#L201
 # Raise Ractor::ClosedError when try to send into a closed actor
 assert_equal 'ok', %q{
   r = Ractor.new { Ractor.receive }
+  r.close_incoming
 
-  r.close
   begin
     r.send(1)
   rescue Ractor::ClosedError
@@ -219,7 +219,7 @@ assert_equal 'ok', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_ractor.rb#L219
     Ractor.receive
   end
 
-  r.close
+  r.close_outgoing
   begin
     r.take
   rescue Ractor::ClosedError
diff --git a/ractor.rb b/ractor.rb
index b9fb429..89e39e5 100644
--- a/ractor.rb
+++ b/ractor.rb
@@ -164,14 +164,6 @@ class Ractor https://github.com/ruby/ruby/blob/trunk/ractor.rb#L164
     }
   end
 
-  # Closes both incoming and outgoing ports.
-  def close
-    close_incoming
-    close_outgoing
-
-    self
-  end
-
   # utility method
   def self.shareable? obj
     __builtin_cexpr! %q{
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]