1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

virCondWaitUntil: calculate timespec correctly

ts.tv_nsec was off by a factor of 1000, making timeouts less than a
second in the future often expiring immediately.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
This commit is contained in:
Michael Chapman 2015-04-16 19:27:36 +10:00 committed by Michal Privoznik
parent c44108522b
commit 3617e3b36d

View File

@ -164,7 +164,7 @@ int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenms)
struct timespec ts;
ts.tv_sec = whenms / 1000;
ts.tv_nsec = (whenms % 1000) * 1000;
ts.tv_nsec = (whenms % 1000) * 1000000;
if ((ret = pthread_cond_timedwait(&c->cond, &m->lock, &ts)) != 0) {
errno = ret;