提交 3617e3b3 编写于 作者: M Michael Chapman 提交者: Michal Privoznik

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: NMichael Chapman <mike@very.puzzling.org>
上级 c4410852
...@@ -164,7 +164,7 @@ int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenms) ...@@ -164,7 +164,7 @@ int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenms)
struct timespec ts; struct timespec ts;
ts.tv_sec = whenms / 1000; 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) { if ((ret = pthread_cond_timedwait(&c->cond, &m->lock, &ts)) != 0) {
errno = ret; errno = ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册