Skip to content

Commit 97123b9

Browse files
committed
remove early pool initialization
1 parent 2013aff commit 97123b9

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

lib/concurrent/configuration.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class Configuration
1414

1515
# Create a new configuration object.
1616
def initialize
17-
@global_task_pool = Delay.new { new_task_pool }
17+
@global_task_pool = Delay.new { new_task_pool }
1818
@global_operation_pool = Delay.new { new_operation_pool }
19-
@global_timer_set = Delay.new { Concurrent::TimerSet.new }
19+
@global_timer_set = Delay.new { Concurrent::TimerSet.new }
2020
end
2121

2222
# Global thread pool optimized for short *tasks*.
@@ -111,11 +111,6 @@ def new_operation_pool
111111
# @yieldparam [Configuration] the current configuration object
112112
def self.configure
113113
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
119114
end
120115

121116
private

spec/concurrent/configuration_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ module Concurrent
2424
Concurrent.configuration.global_task_pool.should eq executor
2525
end
2626

27-
specify 'writer raises an exception if called twice' do
27+
specify 'writer raises an exception if called after initialization' do
2828
executor = ImmediateExecutor.new
2929
Concurrent.configure do |config|
3030
config.global_task_pool = executor
3131
end
32+
Concurrent.configuration.global_task_pool
3233
expect {
3334
Concurrent.configure do |config|
3435
config.global_task_pool = executor
@@ -52,11 +53,12 @@ module Concurrent
5253
Concurrent.configuration.global_operation_pool.should eq executor
5354
end
5455

55-
specify 'writer raises an exception if called twice' do
56+
specify 'writer raises an exception if called after initialization' do
5657
executor = ImmediateExecutor.new
5758
Concurrent.configure do |config|
5859
config.global_operation_pool = executor
5960
end
61+
Concurrent.configuration.global_operation_pool
6062
expect {
6163
Concurrent.configure do |config|
6264
config.global_operation_pool = executor

0 commit comments

Comments
 (0)