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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b2955613976d014a322168f1976a93b29e388b4c72ecf5acdbb0186d212fe7c
4
- data.tar.gz: 57df7539d6fa37fcf41f1d37b6c2fa0a8db5af7af02333da35566fca92a03d8a
3
+ metadata.gz: 0dd43924a88fceee915258e119a02df8fb173199576f52cf18c8298aab091361
4
+ data.tar.gz: 6aeeced1ce99e28238ebd1488a543da6ba4fb885e283f999cec30a49db3a0ccf
5
5
  SHA512:
6
- metadata.gz: 625ef1f9a15205afa2efea139f63b5b800660d57631fda75deccd172f72e82fb6454efe7465edb8024a9a8536b463fa523ead1582dc13aac54dfddb5535e31a9
7
- data.tar.gz: d0e0b1ff25b25ce5b9d3223fa01b3f04b4eefa7e316d55bad95686265f194aee24599e146c1ef9a05dd20dc16f670733e17e494ccd469ea9aef7e4a8b2fb973c
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 we handle
36
- # directories ourselves, so the callback needs to account for concurrency.
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
- mutex2.synchronize do
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
@@ -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 Mutex
95
- attr_reader :mutex2
96
- private :mutex2
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zeitwerk
4
- VERSION = "2.6.10"
4
+ VERSION = "2.6.11"
5
5
  end
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.10
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-07-30 00:00:00.000000000 Z
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