[前][次][番号順一覧][スレッド一覧]

ruby-changes:64126

From: Nobuyoshi <ko1@a...>
Date: Sun, 13 Dec 2020 14:06:56 +0900 (JST)
Subject: [ruby-changes:64126] c7530f0d56 (master): Wait testing/helper threads to terminate

https://git.ruby-lang.org/ruby.git/commit/?id=c7530f0d56

From c7530f0d568e9772bef22a93907f92d8cd872995 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 13 Dec 2020 13:39:57 +0900
Subject: Wait testing/helper threads to terminate


diff --git a/test/net/smtp/test_sslcontext.rb b/test/net/smtp/test_sslcontext.rb
index dd741cf..4f1dcfe 100644
--- a/test/net/smtp/test_sslcontext.rb
+++ b/test/net/smtp/test_sslcontext.rb
@@ -33,7 +33,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/test/net/smtp/test_sslcontext.rb#L33
     end
 
     def teardown
-      @server_thread&.exit
+      @server_thread&.exit&.join
       @server_socket&.close
       @client_socket&.close
     end
diff --git a/test/net/smtp/test_starttls.rb b/test/net/smtp/test_starttls.rb
index a0855b9..4a29fa6 100644
--- a/test/net/smtp/test_starttls.rb
+++ b/test/net/smtp/test_starttls.rb
@@ -19,7 +19,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/test/net/smtp/test_starttls.rb#L19
     end
 
     def teardown
-      @server_thread&.exit
+      @server_thread&.exit&.join
       @server_socket&.close
       @client_socket&.close
     end
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 0eb5d74..3852cb7 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -230,9 +230,9 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L230
     assert_equal(t1, t3.value)
 
   ensure
-    t1&.kill
-    t2&.kill
-    t3&.kill
+    t1&.kill&.join
+    t2&.kill&.join
+    t3&.kill&.join
   end
 
   { 'FIXNUM_MAX' => RbConfig::LIMITS['FIXNUM_MAX'],
@@ -630,7 +630,7 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L630
     Thread.pass until t.stop?
     assert_predicate(t, :alive?)
   ensure
-    t&.kill
+    t&.kill&.join
   end
 
   def test_mutex_deadlock
@@ -1119,7 +1119,7 @@ q.pop https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L1119
       Thread.pass until mutex.locked?
       assert_equal(mutex.owned?, false)
     ensure
-      th&.kill
+      th&.kill&.join
     end
   end
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]