mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
ch: Prepare virCHDriverGetCapabilities for automatic mutex management
No functional change intended. This change makes the refactoring to automatic mutex management easier to follow. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
241c13a7e5
commit
0a6ff46c9e
@ -87,21 +87,22 @@ virCaps *virCHDriverCapsInit(void)
|
||||
virCaps *virCHDriverGetCapabilities(virCHDriver *driver,
|
||||
bool refresh)
|
||||
{
|
||||
virCaps *ret;
|
||||
if (refresh) {
|
||||
virCaps *caps = NULL;
|
||||
if ((caps = virCHDriverCapsInit()) == NULL)
|
||||
return NULL;
|
||||
virCaps *ret = NULL;
|
||||
virCaps *caps = NULL;
|
||||
|
||||
chDriverLock(driver);
|
||||
if (refresh && !(caps = virCHDriverCapsInit()))
|
||||
return NULL;
|
||||
|
||||
chDriverLock(driver);
|
||||
|
||||
if (refresh) {
|
||||
virObjectUnref(driver->caps);
|
||||
driver->caps = caps;
|
||||
} else {
|
||||
chDriverLock(driver);
|
||||
}
|
||||
|
||||
ret = virObjectRef(driver->caps);
|
||||
chDriverUnlock(driver);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user