if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
goto destroy_dom;
- if (virAtomicIntInc(&driver->nactive) == 0 && driver->inhibitCallback)
+ if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
driver->inhibitCallback(true, driver->inhibitOpaque);
/* finally we can call the 'started' hook script if any */
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
VIR_DOMAIN_RUNNING_UNKNOWN);
- if (virAtomicIntInc(&driver->nactive) == 0 && driver->inhibitCallback)
+ if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
driver->inhibitCallback(true, driver->inhibitOpaque);
/* Enable domain death events */
if (virCommandHandshakeNotify(cmd) < 0)
goto cleanup;
- if (virAtomicIntInc(&driver->nactive) == 0 && driver->inhibitCallback)
+ if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
driver->inhibitCallback(true, driver->inhibitOpaque);
if (lxcContainerWaitForContinue(handshakefds[0]) < 0) {
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
VIR_DOMAIN_RUNNING_UNKNOWN);
- if (virAtomicIntInc(&driver->nactive) == 0 && driver->inhibitCallback)
+ if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
driver->inhibitCallback(true, driver->inhibitOpaque);
if (!(priv->monitor = virLXCProcessConnectMonitor(driver, vm)))
static void
virNWFilterSnoopReqGet(virNWFilterSnoopReqPtr req)
{
- virAtomicIntInc(&req->refctr);
+ g_atomic_int_add(&req->refctr, 1);
}
/*
/* put the lease on the req's list */
virNWFilterSnoopIPLeaseTimerAdd(pl);
- virAtomicIntInc(&virNWFilterSnoopState.nLeases);
+ g_atomic_int_add(&virNWFilterSnoopState.nLeases, 1);
exit:
if (update_leasefile)
ret = virThreadPoolSendJob(pool, 0, job);
if (ret == 0)
- virAtomicIntInc(qCtr);
+ g_atomic_int_add(qCtr, 1);
else
VIR_FREE(job);
threadPuts = true;
- virAtomicIntInc(&virNWFilterSnoopState.nThreads);
+ g_atomic_int_add(&virNWFilterSnoopState.nThreads, 1);
req->threadkey = virNWFilterSnoopActivate(req);
if (!req->threadkey) {
goto err_exit;
/* keep dead leases at < ~95% of file size */
- if (virAtomicIntInc(&virNWFilterSnoopState.wLeases) >=
+ if (g_atomic_int_add(&virNWFilterSnoopState.wLeases, 1) >=
g_atomic_int_get(&virNWFilterSnoopState.nLeases) * 20)
virNWFilterSnoopLeaseFileLoad(); /* load & refresh lease file */
qemuDomainSetFakeReboot(driver, vm, false);
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_STARTING_UP);
- if (virAtomicIntInc(&driver->nactive) == 0 && driver->inhibitCallback)
+ if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
driver->inhibitCallback(true, driver->inhibitOpaque);
/* Run an early hook to set-up missing devices */
goto error;
}
- if (virAtomicIntInc(&driver->nactive) == 0 && driver->inhibitCallback)
+ if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
driver->inhibitCallback(true, driver->inhibitOpaque);
cleanup:
#include "internal.h"
-/**
- * virAtomicIntInc:
- * Increments the value of atomic by 1.
- *
- * Think of this operation as an atomic version of
- * { tmp = *atomic; *atomic += 1; return tmp; }
- *
- * This call acts as a full compiler and hardware memory barrier.
- */
-#define virAtomicIntInc(i) g_atomic_int_add(i, 1)
-
/**
* virAtomicIntDecAndTest:
* Decrements the value of atomic by 1.
goto error;
klass->parent = parent;
- klass->magic = virAtomicIntInc(&magicCounter);
+ klass->magic = g_atomic_int_add(&magicCounter, 1);
if (klass->magic > 0xCAFEFFFF) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("too many object classes defined"));
if (VIR_OBJECT_NOTVALID(obj))
return NULL;
- virAtomicIntInc(&obj->u.s.refs);
+ g_atomic_int_add(&obj->u.s.refs, 1);
PROBE(OBJECT_REF, "obj=%p", obj);
return anyobj;
}
unsigned long long *timestamp)
{
static int warned;
- if (virAtomicIntInc(&warned) == 0) {
+ if (g_atomic_int_add(&warned, 1) == 0) {
VIR_WARN("Process start time of pid %lld not available on this platform",
(long long) pid);
}