mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 02:15:23 +00:00
src: Drop virAtomicIntDecAndTest() with g_atomic_int_dec_and_test()
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
574678a27f
commit
7390ff3caa
@ -878,7 +878,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
|
||||
|
||||
priv->ignoreDeathEvent = false;
|
||||
|
||||
if (virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback)
|
||||
if (!!g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
|
||||
driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||
|
||||
if ((vm->def->ngraphics == 1) &&
|
||||
|
@ -208,7 +208,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
|
||||
vm->pid = -1;
|
||||
vm->def->id = -1;
|
||||
|
||||
if (virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback)
|
||||
if (!!g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
|
||||
driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||
|
||||
virLXCDomainReAttachHostDevices(driver, vm->def);
|
||||
|
@ -692,7 +692,7 @@ virNWFilterSnoopReqPut(virNWFilterSnoopReqPtr req)
|
||||
|
||||
virNWFilterSnoopLock();
|
||||
|
||||
if (virAtomicIntDecAndTest(&req->refctr)) {
|
||||
if (!!g_atomic_int_dec_and_test(&req->refctr)) {
|
||||
/*
|
||||
* delete the request:
|
||||
* - if we don't find req on the global list anymore
|
||||
@ -868,7 +868,7 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
|
||||
skip_instantiate:
|
||||
VIR_FREE(ipl);
|
||||
|
||||
ignore_value(virAtomicIntDecAndTest(&virNWFilterSnoopState.nLeases));
|
||||
ignore_value(!!g_atomic_int_dec_and_test(&virNWFilterSnoopState.nLeases));
|
||||
|
||||
lease_not_found:
|
||||
VIR_FREE(ipstr);
|
||||
@ -1142,7 +1142,7 @@ static void virNWFilterDHCPDecodeWorker(void *jobdata, void *opaque)
|
||||
_("Instantiation of rules failed on "
|
||||
"interface '%s'"), req->binding->portdevname);
|
||||
}
|
||||
ignore_value(virAtomicIntDecAndTest(job->qCtr));
|
||||
ignore_value(!!g_atomic_int_dec_and_test(job->qCtr));
|
||||
VIR_FREE(job);
|
||||
}
|
||||
|
||||
@ -1543,7 +1543,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
||||
pcap_close(pcapConf[i].handle);
|
||||
}
|
||||
|
||||
ignore_value(virAtomicIntDecAndTest(&virNWFilterSnoopState.nThreads));
|
||||
ignore_value(!!g_atomic_int_dec_and_test(&virNWFilterSnoopState.nThreads));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -7313,7 +7313,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
|
||||
|
||||
qemuProcessBuildDestroyMemoryPaths(driver, vm, NULL, false);
|
||||
|
||||
if (virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback)
|
||||
if (!!g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
|
||||
driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||
|
||||
/* Wake up anything waiting on domain condition */
|
||||
|
@ -26,17 +26,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/**
|
||||
* virAtomicIntDecAndTest:
|
||||
* Decrements the value of atomic by 1.
|
||||
*
|
||||
* Think of this operation as an atomic version of
|
||||
* { *atomic -= 1; return *atomic == 0; }
|
||||
*
|
||||
* This call acts as a full compiler and hardware memory barrier.
|
||||
*/
|
||||
#define virAtomicIntDecAndTest(i) (!!g_atomic_int_dec_and_test(i))
|
||||
|
||||
/**
|
||||
* virAtomicIntCompareExchange:
|
||||
* Compares atomic to oldval and, if equal, sets it to newval. If
|
||||
|
@ -344,7 +344,7 @@ virObjectUnref(void *anyobj)
|
||||
if (VIR_OBJECT_NOTVALID(obj))
|
||||
return false;
|
||||
|
||||
bool lastRef = virAtomicIntDecAndTest(&obj->u.s.refs);
|
||||
bool lastRef = !!g_atomic_int_dec_and_test(&obj->u.s.refs);
|
||||
PROBE(OBJECT_UNREF, "obj=%p", obj);
|
||||
if (lastRef) {
|
||||
PROBE(OBJECT_DISPOSE, "obj=%p", obj);
|
||||
|
Loading…
x
Reference in New Issue
Block a user