diff options
| author | rm155 <rohitmenon@verizon.net> | 2021-07-22 13:19:29 -0400 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-03-26 08:41:51 +0900 |
| commit | 6a7e3cb5fac3137ad212db8ab3388656937a4451 (patch) | |
| tree | 49b5c1f4e9374544720147a1ed3d68248d70acc3 | |
| parent | acfdc0ac885ea4641f2e7d9d966fbb2acca7c883 (diff) | |
[ruby/pstore] Improve Ractor-compliance
https://github.com/ruby/pstore/commit/fa564a6965
| -rw-r--r-- | lib/pstore.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/pstore.rb b/lib/pstore.rb index 818ffa07e0..dd37f4950a 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -602,6 +602,9 @@ class PStore EMPTY_MARSHAL_DATA = Marshal.dump({}) EMPTY_MARSHAL_CHECKSUM = CHECKSUM_ALGO.digest(EMPTY_MARSHAL_DATA) + EMPTY_MARSHAL_DATA.freeze + EMPTY_MARSHAL_CHECKSUM.freeze + # # Open the specified filename (either in read-only mode or in # read-write mode) and lock it for reading or writing. @@ -666,9 +669,12 @@ class PStore def on_windows? is_windows = RUBY_PLATFORM =~ /mswin|mingw|bccwin|wince/ - self.class.__send__(:define_method, :on_windows?) do + + on_windows_proc = Proc.new do is_windows end + Ractor.make_shareable(on_windows_proc) if defined?(Ractor) + self.class.__send__(:define_method, :on_windows?, &on_windows_proc) is_windows end |
