diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-12-12 06:54:46 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-12-12 08:36:52 +0900 |
commit | 70a311fdeb66ce80b562ccc4459c409cea64b74c (patch) | |
tree | 759740cde8a1b1b86505b119af8b585325459974 /bootstraptest | |
parent | 124321e0c7ab8dac1ffce78c653cc677f878d5b0 (diff) | |
download | ruby-70a311fdeb66ce80b562ccc4459c409cea64b74c.tar.gz |
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.
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_ractor.rb | 18 |
1 files changed, 18 insertions, 0 deletions
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 ### |