kvm: Add handling of EAGAIN when creating timers

timer_create can apparently return -1 and set errno to EAGAIN if the
kernel suffered a temporary failure when allocating a timer. This
happens from time to time, so we need to handle it.
This commit is contained in:
Andreas Sandberg 2013-06-03 13:38:59 +02:00
parent 743f80712e
commit 15f81b6ed9

View file

@ -59,8 +59,11 @@ PosixKvmTimer::PosixKvmTimer(int signo, clockid_t clockID,
sev.sigev_notify = SIGEV_SIGNAL;
sev.sigev_signo = signo;
sev.sigev_value.sival_ptr = NULL;
if (timer_create(clockID, &sev, &timer) == -1)
panic("timer_create");
while (timer_create(clockID, &sev, &timer) == -1) {
if (errno != EAGAIN)
panic("timer_create: %i", errno);
}
}
PosixKvmTimer::~PosixKvmTimer()