From: Pavel Hrdina Date: Mon, 29 Jun 2015 14:10:36 +0000 (+0200) Subject: virCondWaitUntil: add another return value X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5c48618f114a62b463dbc8981365448826e6df8b;p=libvirt.git virCondWaitUntil: add another return value We should distinguish between success and timeout, to let the user handle those two events differently. Signed-off-by: Pavel Hrdina --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0219c3c481..bc539d5638 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2687,15 +2687,25 @@ virDomainObjWait(virDomainObjPtr vm) } +/** + * Waits for domain condition to be triggered for a specific period of time. + * + * Returns: + * -1 in case of error + * 0 on success + * 1 on timeout + */ int virDomainObjWaitUntil(virDomainObjPtr vm, unsigned long long whenms) { - if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) < 0 && - errno != ETIMEDOUT) { - virReportSystemError(errno, "%s", - _("failed to wait for domain condition")); - return -1; + if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) < 0) { + if (errno != ETIMEDOUT) { + virReportSystemError(errno, "%s", + _("failed to wait for domain condition")); + return -1; + } + return 1; } return 0; }