[2.7] bpo-31150: Wait for child process in test_forkinthread to avoid thread reaped warnings (#3042)

diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index 2f9abe0..c8caa5d 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -245,6 +245,8 @@
                 os._exit(0)
             else: # parent
                 os.close(self.write_fd)
+                pid, status = os.waitpid(pid, 0)
+                self.assertEqual(status, 0)
 
         thread.start_new_thread(thread1, ())
         self.assertEqual(os.read(self.read_fd, 2), "OK",