Use daemon property instead of setDaemon method
The setDaemon method of the threading.Thread was deprecated in Python 3.10 (*). Replace the setDaemon method with the daemon property. *: https://docs.python.org/3.10/library/threading.html#threading.Thread.setDaemon Change-Id: I34c7753ae1ba3704a1c2ec1a9b5a9905b6bcb8f5 Signed-off-by: Takashi Natsume <takanattie@gmail.com>
This commit is contained in:
parent
91b20a0171
commit
3be4e4a684
|
@ -76,11 +76,11 @@ class NamedPipeTestCase(test_base.BaseTestCase):
|
|||
thread = namedpipe.threading.Thread
|
||||
thread.assert_has_calls(
|
||||
[mock.call(target=self._handler._read_from_pipe),
|
||||
mock.call().setDaemon(True),
|
||||
mock.call().start(),
|
||||
mock.call(target=self._handler._write_to_pipe),
|
||||
mock.call().setDaemon(True),
|
||||
mock.call().start()])
|
||||
for worker in self._handler._workers:
|
||||
self.assertIs(True, worker.daemon)
|
||||
|
||||
@mock.patch.object(namedpipe.NamedPipeHandler, 'stop')
|
||||
@mock.patch.object(namedpipe.NamedPipeHandler, '_open_pipe')
|
||||
|
|
|
@ -605,7 +605,7 @@ class _ClusterEventListener(object):
|
|||
# If eventlet monkey patching is used, this will actually be a
|
||||
# greenthread. We just don't want to enforce eventlet usage.
|
||||
worker = threading.Thread(target=self._listen)
|
||||
worker.setDaemon(True)
|
||||
worker.daemon = True
|
||||
|
||||
self._running = True
|
||||
worker.start()
|
||||
|
|
|
@ -66,7 +66,7 @@ class NamedPipeHandler(object):
|
|||
|
||||
for job in jobs:
|
||||
worker = threading.Thread(target=job)
|
||||
worker.setDaemon(True)
|
||||
worker.daemon = True
|
||||
worker.start()
|
||||
self._workers.append(worker)
|
||||
except Exception as err:
|
||||
|
|
Loading…
Reference in New Issue