mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 05:57:16 +00:00
adding handling EINTR to poll to make it more robust
some system call and signal will interrupt poll, making event loop stops and fails to react events and keepalive message from libvirt. adding handling EINTR to poll to make it more robust Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
This commit is contained in:
parent
5e21da5630
commit
5e62ba3428
@ -178,6 +178,7 @@ class virEventLoopPure:
|
||||
def run_once(self):
|
||||
sleep = -1
|
||||
self.runningPoll = True
|
||||
try:
|
||||
next = self.next_timeout()
|
||||
debug("Next timeout due at %d" % next)
|
||||
if next > 0:
|
||||
@ -212,13 +213,17 @@ class virEventLoopPure:
|
||||
continue
|
||||
|
||||
want = t.get_last_fired() + interval
|
||||
# Deduct 20ms, since schedular timeslice
|
||||
# Deduct 20ms, since scheduler timeslice
|
||||
# means we could be ever so slightly early
|
||||
if now >= (want-20):
|
||||
debug("Dispatch timer %d now %s want %s" % (t.get_id(), str(now), str(want)))
|
||||
t.set_last_fired(now)
|
||||
t.dispatch()
|
||||
|
||||
except (os.error, select.error), e:
|
||||
if e.args[0] != errno.EINTR:
|
||||
raise
|
||||
finally:
|
||||
self.runningPoll = False
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user