From 70a311fdeb66ce80b562ccc4459c409cea64b74c Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Sat, 12 Dec 2020 06:54:46 +0900 Subject: trap on non-main ractor trap can accept blopck/Proc and it can violate Rator isolation, so the Proc should be isolatable when trap is used on non-main ractor. --- bootstraptest/test_ractor.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bootstraptest/test_ractor.rb') diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index 81bea95e01..b13ecbe3e9 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -1133,6 +1133,24 @@ assert_equal '[true, false]', %q{ }.take } +# Can not trap with not isolated Proc on non-main ractor +assert_equal '[:ok, :ok]', %q{ + a = [] + Ractor.new{ + trap(:INT){p :ok} + }.take + a << :ok + + begin + Ractor.new{ + s = 'str' + trap(:INT){p s} + }.take + rescue => Ractor::RemoteError + a << :ok + end +} + ### ### Synchronization tests ### -- cgit v1.2.3