summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-09-26 15:49:43 -0400
committerMarc-André Lafortune <github@marc-andre.ca>2020-12-09 02:15:41 -0500
commita7dccd08e7c9cf0e5d0c0fdbe659ccc921624e6f (patch)
tree1cbb857586e30af448e5cd59321a09799ce74f5d /lib
parent6b264e833f9b9c86819feff88048ffcdf8d67af8 (diff)
[ruby/matrix] Make frozen matrices Ractor shareable
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3869
Diffstat (limited to 'lib')
-rw-r--r--lib/matrix.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb
index c6193ebee1..32f1e233ce 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -532,7 +532,8 @@ class Matrix
alias map! collect!
def freeze
- @rows.freeze
+ @rows.each(&:freeze).freeze
+
super
end
@@ -2141,6 +2142,9 @@ class Vector
all?(&:zero?)
end
+ #
+ # Makes the matrix frozen and Ractor-shareable
+ #
def freeze
@elements.freeze
super