]> xenbits.xensource.com Git - libvirt.git/commitdiff
src: Drop virAtomicIntDecAndTest() with g_atomic_int_dec_and_test()
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 31 Jan 2020 16:12:11 +0000 (17:12 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Sun, 2 Feb 2020 15:36:56 +0000 (16:36 +0100)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libxl/libxl_domain.c
src/lxc/lxc_process.c
src/nwfilter/nwfilter_dhcpsnoop.c
src/qemu/qemu_process.c
src/util/viratomic.h
src/util/virobject.c

index 8885af451fe8c15fb6c1bd3714555f3b5d66a84e..d53363dc02d094ed0572740e7416e7d7f77fd401 100644 (file)
@@ -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) &&
index 2bb2216dc04ba7a4a985d94378ec6f7dd2b71980..d8ddea6d24c1ce755af12112aa4c897fcae3b0b3 100644 (file)
@@ -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);
index f73913ec9e78dda2d24bff79a9158733f1b2aff6..c4341ee3e2336ed69aea4e755cb5a4d17a4a76f9 100644 (file)
@@ -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;
 }
index 20c4e3bb5d421b436e4d06277bc0f217c61a480f..ed14ce5ea2e7fe7f6a9a5701cb884bc5c023c3de 100644 (file)
@@ -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 */
index 152cfcd9039775ff34a8e252696217eb40ed38b3..1ddc7019f91b928fe5354a0ba5e5a558dd3382ad 100644 (file)
 
 #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
index 9185d3e92ee4871cb2e8fe8cb62e180f48b867ff..7749d89243c297ad9bcd19bbcf1b6073d06de193 100644 (file)
@@ -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);