@@ -9,25 +9,6 @@ module Concurrent
9
9
# An error class to be raised when errors occur during configuration.
10
10
ConfigurationError = Class . new ( StandardError )
11
11
12
- class << self
13
- attr_accessor :configuration
14
- end
15
-
16
- # Perform gem-level configuration.
17
- #
18
- # @yield the configuration commands
19
- # @yieldparam [Configuration] the current configuration object
20
- def self . configure
21
- ( @mutex ||= Mutex . new ) . synchronize do
22
- yield ( configuration )
23
-
24
- # initialize the global thread pools if necessary
25
- configuration . global_task_pool
26
- configuration . global_operation_pool
27
- configuration . global_timer_set
28
- end
29
- end
30
-
31
12
# A gem-level configuration object.
32
13
class Configuration
33
14
@@ -120,6 +101,23 @@ def global_operation_pool=(executor)
120
101
end
121
102
end
122
103
104
+ # create the default configuration on load
105
+ @configuration = Configuration . new
106
+ singleton_class . send :attr_reader , :configuration
107
+
108
+ # Perform gem-level configuration.
109
+ #
110
+ # @yield the configuration commands
111
+ # @yieldparam [Configuration] the current configuration object
112
+ def self . configure
113
+ yield ( configuration )
114
+
115
+ # initialize the global thread pools if necessary
116
+ configuration . global_task_pool
117
+ configuration . global_operation_pool
118
+ configuration . global_timer_set
119
+ end
120
+
123
121
private
124
122
125
123
# Attempt to properly shutdown the given executor using the `shutdown` or
@@ -140,8 +138,6 @@ def self.finalize_executor(executor)
140
138
false
141
139
end
142
140
143
- # create the default configuration on load
144
- self . configuration = Configuration . new
145
141
146
142
# set exit hook to shutdown global thread pools
147
143
at_exit do
0 commit comments