mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
bpo-45187: Fix dangling threads in test_socket.CreateServerFunctionalTest (GH-28422)
(cherry picked from commit 51ebb7f4f5
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
a10726d314
commit
21711d5341
1 changed files with 3 additions and 9 deletions
|
@ -6492,13 +6492,6 @@ class CreateServerTest(unittest.TestCase):
|
|||
class CreateServerFunctionalTest(unittest.TestCase):
|
||||
timeout = support.LOOPBACK_TIMEOUT
|
||||
|
||||
def setUp(self):
|
||||
self.thread = None
|
||||
|
||||
def tearDown(self):
|
||||
if self.thread is not None:
|
||||
self.thread.join(self.timeout)
|
||||
|
||||
def echo_server(self, sock):
|
||||
def run(sock):
|
||||
with sock:
|
||||
|
@ -6512,8 +6505,9 @@ class CreateServerFunctionalTest(unittest.TestCase):
|
|||
|
||||
event = threading.Event()
|
||||
sock.settimeout(self.timeout)
|
||||
self.thread = threading.Thread(target=run, args=(sock, ))
|
||||
self.thread.start()
|
||||
thread = threading.Thread(target=run, args=(sock, ))
|
||||
thread.start()
|
||||
self.addCleanup(thread.join, self.timeout)
|
||||
event.set()
|
||||
|
||||
def echo_client(self, addr, family):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue