[ruby/matrix] Make frozen matrices Ractor shareable

This commit is contained in:
Marc-Andre Lafortune 2020-09-26 15:49:43 -04:00 committed by Marc-André Lafortune
parent 6b264e833f
commit a7dccd08e7
Notes: git 2020-12-09 16:16:06 +09:00
2 changed files with 14 additions and 1 deletions

View file

@ -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