]> xenbits.xensource.com Git - libvirt.git/commitdiff
python example: poll(-0.001) does not sleep forever
authorPhilipp Hahn <hahn@univention.de>
Tue, 23 Mar 2010 15:07:57 +0000 (16:07 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 24 Mar 2010 09:26:23 +0000 (10:26 +0100)
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>
examples/domain-events/events-python/event-test.py

index a9ca26bc5ac4e56880e1a09b873c7c63d6acdc81..181b3895117147d3e6fa8885828dd58bb5de1a07 100644 (file)
@@ -172,10 +172,10 @@ class virEventLoopPure:
             if now >= next:
                 sleep = 0
             else:
-                sleep = next - now
+                sleep = (next - now) / 1000.0
 
         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
         for (fd, revents) in events: