Skip to content

Commit ca98f72

Browse files
authored
Merge pull request #116 from kbrock/thread_safety2
fix sporadic thread_safety test failure
2 parents c574a2c + 84883a9 commit ca98f72

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spec/core_ext/module/cache_with_timeout_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
# clears the current value, the other thread could get nil.
164164
test_class.cache_with_timeout(:thread_safety) { 2 }
165165

166-
Thread.new do
166+
t = Thread.new do
167167
10000.times do
168168
test_class.thread_safety(true)
169169
end
@@ -172,6 +172,7 @@
172172
10000.times do
173173
expect(test_class.thread_safety).to eq(2)
174174
end
175+
t.join
175176
end
176177
end
177178
end

0 commit comments

Comments
 (0)