zeitwerk 2.6.10 → 2.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zeitwerk/loader/callbacks.rb +4 -3
- data/lib/zeitwerk/loader.rb +7 -5
- data/lib/zeitwerk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dd43924a88fceee915258e119a02df8fb173199576f52cf18c8298aab091361
|
4
|
+
data.tar.gz: 6aeeced1ce99e28238ebd1488a543da6ba4fb885e283f999cec30a49db3a0ccf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca6b895667327b79fe51d504de760150aeceba5edb64400a6976962c1241bb8061f5c29e4d8584ba888694a0b1b30cf2f149f66f52181089fda262dde541d902
|
7
|
+
data.tar.gz: 8393b41bda4187ce0195ce5b1192455a2bc574291188b0eba86f31af88fc66e3d441717823ac07407f8c7be4e4a97de06cb5bc1922a133e66ed51cc91f6eb1c7
|
@@ -32,8 +32,9 @@ module Zeitwerk::Loader::Callbacks
|
|
32
32
|
# @private
|
33
33
|
# @sig (String) -> void
|
34
34
|
def on_dir_autoloaded(dir)
|
35
|
-
# Module#autoload does not serialize concurrent requires, and
|
36
|
-
# directories ourselves
|
35
|
+
# Module#autoload does not serialize concurrent requires in CRuby < 3.2, and
|
36
|
+
# we handle directories ourselves without going through Kernel#require, so
|
37
|
+
# the callback needs to account for concurrency.
|
37
38
|
#
|
38
39
|
# Multi-threading would introduce a race condition here in which thread t1
|
39
40
|
# autovivifies the module, and while autoloads for its children are being
|
@@ -43,7 +44,7 @@ module Zeitwerk::Loader::Callbacks
|
|
43
44
|
# That not only would reassign the constant (undesirable per se) but, worse,
|
44
45
|
# the module object created by t2 wouldn't have any of the autoloads for its
|
45
46
|
# children, since t1 would have correctly deleted its namespace_dirs entry.
|
46
|
-
|
47
|
+
dirs_autoload_monitor.synchronize do
|
47
48
|
if cref = autoloads.delete(dir)
|
48
49
|
autovivified_module = cref[0].const_set(cref[1], Module.new)
|
49
50
|
cpath = autovivified_module.name
|
data/lib/zeitwerk/loader.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "monitor"
|
3
4
|
require "set"
|
4
5
|
|
5
6
|
module Zeitwerk
|
@@ -91,9 +92,9 @@ module Zeitwerk
|
|
91
92
|
attr_reader :mutex
|
92
93
|
private :mutex
|
93
94
|
|
94
|
-
# @sig
|
95
|
-
attr_reader :
|
96
|
-
private :
|
95
|
+
# @sig Monitor
|
96
|
+
attr_reader :dirs_autoload_monitor
|
97
|
+
private :dirs_autoload_monitor
|
97
98
|
|
98
99
|
def initialize
|
99
100
|
super
|
@@ -103,11 +104,12 @@ module Zeitwerk
|
|
103
104
|
@to_unload = {}
|
104
105
|
@namespace_dirs = Hash.new { |h, cpath| h[cpath] = [] }
|
105
106
|
@shadowed_files = Set.new
|
106
|
-
@mutex = Mutex.new
|
107
|
-
@mutex2 = Mutex.new
|
108
107
|
@setup = false
|
109
108
|
@eager_loaded = false
|
110
109
|
|
110
|
+
@mutex = Mutex.new
|
111
|
+
@dirs_autoload_monitor = Monitor.new
|
112
|
+
|
111
113
|
Registry.register_loader(self)
|
112
114
|
end
|
113
115
|
|
data/lib/zeitwerk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeitwerk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Noria
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Zeitwerk implements constant autoloading with Ruby semantics. Each gem
|