From 1d1186794e8f489d8c58b64f2f5eb5570a17b09d Mon Sep 17 00:00:00 2001 From: David Verhasselt Date: Sun, 17 Apr 2016 15:09:46 +0300 Subject: [PATCH] Cleanup threads --- spec/semaphore_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/semaphore_spec.rb b/spec/semaphore_spec.rb index 04ceb26..e2c0d65 100644 --- a/spec/semaphore_spec.rb +++ b/spec/semaphore_spec.rb @@ -285,11 +285,12 @@ it "gracefully expires stale lock" do expiration = 1 - Thread.new do - semaphore.simple_expiring_mutex(:test, expiration) do - sleep 3 + thread = + Thread.new do + semaphore.simple_expiring_mutex(:test, expiration) do + sleep 3 + end end - end sleep 1.5 @@ -303,6 +304,7 @@ end expect(it_worked).to be_truthy + thread.join end end end