summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-10-20 11:24:37 +0900
committerKoichi Sasada <ko1@atdot.net>2020-10-20 15:39:37 +0900
commitade411465dc054af5ff025531649b69134d74b56 (patch)
tree8c7a95802fa4a1523ae54cd2858fb0fcbaa84c67 /bootstraptest
parent2bdbdc1580f52dc8d70a71b824238e0f20342dca (diff)
ObjectSpace.each_object with Ractors
Unshareable objects should not be touched from multiple ractors so ObjectSpace.each_object should be restricted. On multi-ractor mode, ObjectSpace.each_object only iterates shareable objects. [Feature #17270]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3672
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ractor.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 94570597ba..a02adb612a 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -823,6 +823,15 @@ assert_equal '[1, 4, 3, 2, 1]', %q{
counts.inspect
}
+# ObjectSpace.each_object can not handle unshareable objects with Ractors
+assert_equal '0', %q{
+ Ractor.new{
+ n = 0
+ ObjectSpace.each_object{|o| n += 1 unless Ractor.shareable?(o)}
+ n
+ }.take
+}
+
###
### Synchronization tests
###