aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/conditionvariable/wait_spec.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-06 13:36:02 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-06 14:50:32 +0900
commit3d83e641b1a6e13e0e0a59c19536e1dde96891f4 (patch)
tree6bd0ac843934ea6daed121ea49b1d37bae85f4a0 /spec/ruby/library/conditionvariable/wait_spec.rb
parent34f8e75f9305b0da4ef1b0d4fe9ea3c3f31dcc22 (diff)
downloadruby-3d83e641b1a6e13e0e0a59c19536e1dde96891f4.tar.gz
[ruby/spec] Check by Thread#stop?
Check if threads are stopped by Thread#stop? instead of the status name.
Diffstat (limited to 'spec/ruby/library/conditionvariable/wait_spec.rb')
-rw-r--r--spec/ruby/library/conditionvariable/wait_spec.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/ruby/library/conditionvariable/wait_spec.rb b/spec/ruby/library/conditionvariable/wait_spec.rb
index 59d708d7e6..b6cd12ed4e 100644
--- a/spec/ruby/library/conditionvariable/wait_spec.rb
+++ b/spec/ruby/library/conditionvariable/wait_spec.rb
@@ -26,7 +26,7 @@ describe "ConditionVariable#wait" do
# wait for m to acquire the mutex
Thread.pass until in_synchronize
# wait until th is sleeping (ie waiting)
- Thread.pass while th.status and th.status != "sleep"
+ Thread.pass until th.stop?
m.synchronize { cv.signal }
th.join
@@ -48,7 +48,7 @@ describe "ConditionVariable#wait" do
# wait for m to acquire the mutex
Thread.pass until in_synchronize
# wait until th is sleeping (ie waiting)
- Thread.pass while th.status and th.status != "sleep"
+ Thread.pass until th.stop?
th.run
th.value.should == :success
@@ -70,7 +70,7 @@ describe "ConditionVariable#wait" do
# wait for m to acquire the mutex
Thread.pass until in_synchronize
# wait until th is sleeping (ie waiting)
- Thread.pass while th.status and th.status != "sleep"
+ Thread.pass until th.stop?
th.wakeup
th.value.should == :success
@@ -97,7 +97,7 @@ describe "ConditionVariable#wait" do
# wait for m to acquire the mutex
Thread.pass until in_synchronize
# wait until th is sleeping (ie waiting)
- Thread.pass while th.status and th.status != "sleep"
+ Thread.pass until th.stop?
th.kill
th.join
@@ -127,7 +127,7 @@ describe "ConditionVariable#wait" do
# wait for m to acquire the mutex
Thread.pass until in_synchronize
# wait until th is sleeping (ie waiting)
- Thread.pass while th.status and th.status != "sleep"
+ Thread.pass until th.stop?
m.synchronize {
cv.signal
@@ -158,7 +158,7 @@ describe "ConditionVariable#wait" do
}
Thread.pass until m.synchronize { events.size } == n_threads
- Thread.pass while threads.any? { |th| th.status and th.status != "sleep" }
+ Thread.pass until threads.any?(&:stop?)
m.synchronize do
threads.each { |t|
# Cause interactions with the waiting threads.