mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
python example: poll(-0.001) does not sleep forever
The conversion from seconds to milliseconds should only be done for actual delays >= 0, not for the magic -1 value used for infinite timeouts. Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
parent
84eb6effdd
commit
1cfbfaa697
@ -172,10 +172,10 @@ class virEventLoopPure:
|
|||||||
if now >= next:
|
if now >= next:
|
||||||
sleep = 0
|
sleep = 0
|
||||||
else:
|
else:
|
||||||
sleep = next - now
|
sleep = (next - now) / 1000.0
|
||||||
|
|
||||||
self.debug("Poll with a sleep of %d" % sleep)
|
self.debug("Poll with a sleep of %d" % sleep)
|
||||||
events = self.poll.poll(sleep / 1000.0)
|
events = self.poll.poll(sleep)
|
||||||
|
|
||||||
# Dispatch any file handle events that occurred
|
# Dispatch any file handle events that occurred
|
||||||
for (fd, revents) in events:
|
for (fd, revents) in events:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user