mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-27 11:41:52 +03:00
examples: remove use of deprecated setDaemon method
In Python 3.10 the setDaemon method was deprecated. It is redundant since the 'daemon' parameter can be given when creating the thread, or the 'daemon' attribute can be set after it was created. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@ -438,8 +438,9 @@ def virEventLoopNativeRun() -> None:
|
||||
def virEventLoopPollStart() -> None:
|
||||
global eventLoopThread
|
||||
virEventLoopPollRegister()
|
||||
eventLoopThread = threading.Thread(target=virEventLoopPollRun, name="libvirtEventLoop")
|
||||
eventLoopThread.setDaemon(True)
|
||||
eventLoopThread = threading.Thread(target=virEventLoopPollRun,
|
||||
name="libvirtEventLoop",
|
||||
daemon=True)
|
||||
eventLoopThread.start()
|
||||
|
||||
|
||||
@ -449,16 +450,19 @@ def virEventLoopAIOStart() -> None:
|
||||
import asyncio
|
||||
loop = asyncio.new_event_loop()
|
||||
libvirtaio.virEventRegisterAsyncIOImpl(loop=loop)
|
||||
eventLoopThread = threading.Thread(target=virEventLoopAIORun, args=(loop,), name="libvirtEventLoop")
|
||||
eventLoopThread.setDaemon(True)
|
||||
eventLoopThread = threading.Thread(target=virEventLoopAIORun,
|
||||
args=(loop,),
|
||||
name="libvirtEventLoop",
|
||||
daemon=True)
|
||||
eventLoopThread.start()
|
||||
|
||||
|
||||
def virEventLoopNativeStart() -> None:
|
||||
global eventLoopThread
|
||||
libvirt.virEventRegisterDefaultImpl()
|
||||
eventLoopThread = threading.Thread(target=virEventLoopNativeRun, name="libvirtEventLoop")
|
||||
eventLoopThread.setDaemon(True)
|
||||
eventLoopThread = threading.Thread(target=virEventLoopNativeRun,
|
||||
name="libvirtEventLoop",
|
||||
daemon=True)
|
||||
eventLoopThread.start()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user