mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
89a5e25d05
qemuBlockJobSyncBegin and qemuBlockJobSyncEnd delimit a region of code where block job events are processed "synchronously". qemuBlockJobSyncWait and qemuBlockJobSyncWaitWithTimeout wait for an event generated by a block job. The Wait* functions may be called multiple times while the synchronous block job is active. Any pending block job event will be processed by only when Wait* or End is called. disk->blockJobStatus is reset by these functions, so if it is needed a pointer to a virConnectDomainEventBlockJobStatus variable should be passed as the last argument. It is safe to pass NULL if you do not care about the block job status. All functions assume the VM object is locked. The Wait* functions will unlock the object for as long as they are waiting. They will return -1 and report an error if the domain exits before an event is received. Typical use is as follows: virQEMUDriverPtr driver; virDomainObjPtr vm; /* locked */ virDomainDiskDefPtr disk; virConnectDomainEventBlockJobStatus status; qemuBlockJobSyncBegin(disk); ... start block job ... if (qemuBlockJobSyncWait(driver, vm, disk, &status) < 0) { /* domain died while waiting for event */ ret = -1; goto error; } ... possibly start other block jobs or wait for further events ... qemuBlockJobSyncEnd(driver, vm, disk, NULL); To perform other tasks periodically while waiting for an event: virQEMUDriverPtr driver; virDomainObjPtr vm; /* locked */ virDomainDiskDefPtr disk; virConnectDomainEventBlockJobStatus status; unsigned long long timeout = 500 * 1000ull; /* milliseconds */ qemuBlockJobSyncBegin(disk); ... start block job ... do { ... do other task ... if (qemuBlockJobSyncWaitWithTimeout(driver, vm, disk, timeout, &status) < 0) { /* domain died while waiting for event */ ret = -1; goto error; } } while (status == -1); qemuBlockJobSyncEnd(driver, vm, disk, NULL); Signed-off-by: Michael Chapman <mike@very.puzzling.org> |
||
---|---|---|
.. | ||
ar.po | ||
as.po | ||
bg.po | ||
bn_IN.po | ||
bn.po | ||
bs.po | ||
ca.po | ||
cs.po | ||
cy.po | ||
da.po | ||
de.po | ||
el.po | ||
en_GB.po | ||
es.po | ||
et.po | ||
fi.po | ||
fr.po | ||
gl.po | ||
gu.po | ||
he.po | ||
hi.po | ||
hu.po | ||
id.po | ||
is.po | ||
it.po | ||
ja.po | ||
ka.po | ||
kn.po | ||
ko.po | ||
libvirt.pot | ||
lt.po | ||
lv.po | ||
mk.po | ||
ml.po | ||
mr.po | ||
ms.po | ||
nb.po | ||
nl.po | ||
nn.po | ||
nso.po | ||
or.po | ||
pa.po | ||
pl.po | ||
POTFILES.in | ||
pt_BR.po | ||
pt.po | ||
ro.po | ||
ru.po | ||
si.po | ||
sk.po | ||
sl.po | ||
sq.po | ||
sr.po | ||
sr@latin.po | ||
sv.po | ||
ta.po | ||
te.po | ||
th.po | ||
tr.po | ||
uk.po | ||
ur.po | ||
vi.po | ||
zanata.xml | ||
zh_CN.po | ||
zh_TW.po | ||
zu.po |