Skip to content

Commit 6551a88

Browse files
author
Nicolas Laurent
committed
introduce SynchronizedArray to avoid race conditions on $LOADED_FEATURES and $LOAD_PATH
1 parent df8d21a commit 6551a88

File tree

4 files changed

+739
-2
lines changed

4 files changed

+739
-2
lines changed

src/main/java/org/truffleruby/core/CoreLibrary.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ public boolean isTruffleBootMainMethod(SharedMethodInfo info) {
978978
"/core/truffle/platform.rb",
979979
"/core/string.rb",
980980
"/core/random.rb",
981+
"/core/truffle/synchronized_array.rb",
981982
"/core/truffle/kernel_operations.rb",
982983
"/core/truffle/exception_operations.rb",
983984
"/core/truffle/feature_loader.rb",

src/main/ruby/truffleruby/core/truffle/kernel_operations.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def self.define_read_only_global(name, getter)
3131
define_hooked_variable(name, getter, setter)
3232
end
3333

34-
LOAD_PATH = []
35-
LOADED_FEATURES = []
34+
LOAD_PATH = Truffle::SynchronizedArray.new
35+
LOADED_FEATURES = Truffle::SynchronizedArray.new
3636

3737
define_read_only_global(:$LOAD_PATH, -> { LOAD_PATH })
3838
define_read_only_global(:$LOADED_FEATURES, -> { LOADED_FEATURES })

0 commit comments

Comments
 (0)