mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +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
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user