mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
[ruby/matrix] Make frozen matrices Ractor shareable
This commit is contained in:
parent
6b264e833f
commit
a7dccd08e7
Notes:
git
2020-12-09 16:16:06 +09:00
2 changed files with 14 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue