mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
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 <phrdina@redhat.com>
This commit is contained in:
parent
b5c2245b0c
commit
5c48618f11
@ -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
|
int
|
||||||
virDomainObjWaitUntil(virDomainObjPtr vm,
|
virDomainObjWaitUntil(virDomainObjPtr vm,
|
||||||
unsigned long long whenms)
|
unsigned long long whenms)
|
||||||
{
|
{
|
||||||
if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) < 0 &&
|
if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) < 0) {
|
||||||
errno != ETIMEDOUT) {
|
if (errno != ETIMEDOUT) {
|
||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
_("failed to wait for domain condition"));
|
_("failed to wait for domain condition"));
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user