mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 05:25:18 +00:00
src: Replace virAtomicIntGet() with g_atomic_int_get()
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
18a6f18280
commit
8567ff1f5c
@ -601,7 +601,7 @@ virNWFilterSnoopReqFree(virNWFilterSnoopReqPtr req)
|
||||
if (!req)
|
||||
return;
|
||||
|
||||
if (virAtomicIntGet(&req->refctr) != 0)
|
||||
if (g_atomic_int_get(&req->refctr) != 0)
|
||||
return;
|
||||
|
||||
/* free all leases */
|
||||
@ -1477,7 +1477,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
||||
unsigned int diff;
|
||||
|
||||
/* submit packet to worker thread */
|
||||
if (virAtomicIntGet(&pcapConf[i].qCtr) >
|
||||
if (g_atomic_int_get(&pcapConf[i].qCtr) >
|
||||
pcapConf[i].maxQSize) {
|
||||
if (last_displayed_queue - time(0) > 10) {
|
||||
last_displayed_queue = time(0);
|
||||
@ -1778,7 +1778,7 @@ virNWFilterSnoopLeaseFileSave(virNWFilterSnoopIPLeasePtr ipl)
|
||||
|
||||
/* keep dead leases at < ~95% of file size */
|
||||
if (virAtomicIntInc(&virNWFilterSnoopState.wLeases) >=
|
||||
virAtomicIntGet(&virNWFilterSnoopState.nLeases) * 20)
|
||||
g_atomic_int_get(&virNWFilterSnoopState.nLeases) * 20)
|
||||
virNWFilterSnoopLeaseFileLoad(); /* load & refresh lease file */
|
||||
|
||||
err_exit:
|
||||
@ -1809,7 +1809,7 @@ virNWFilterSnoopPruneIter(const void *payload,
|
||||
/*
|
||||
* have the entry removed if it has no leases and no one holds a ref
|
||||
*/
|
||||
del_req = ((req->start == NULL) && (virAtomicIntGet(&req->refctr) == 0));
|
||||
del_req = ((req->start == NULL) && (g_atomic_int_get(&req->refctr) == 0));
|
||||
|
||||
virNWFilterSnoopReqUnlock(req);
|
||||
|
||||
@ -1973,9 +1973,9 @@ virNWFilterSnoopLeaseFileLoad(void)
|
||||
static void
|
||||
virNWFilterSnoopJoinThreads(void)
|
||||
{
|
||||
while (virAtomicIntGet(&virNWFilterSnoopState.nThreads) != 0) {
|
||||
while (g_atomic_int_get(&virNWFilterSnoopState.nThreads) != 0) {
|
||||
VIR_WARN("Waiting for snooping threads to terminate: %u",
|
||||
virAtomicIntGet(&virNWFilterSnoopState.nThreads));
|
||||
g_atomic_int_get(&virNWFilterSnoopState.nThreads));
|
||||
g_usleep(1000 * 1000);
|
||||
}
|
||||
}
|
||||
|
@ -26,15 +26,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/**
|
||||
* virAtomicIntGet:
|
||||
* Gets the current value of atomic.
|
||||
*
|
||||
* This call acts as a full compiler and hardware memory barrier
|
||||
* (before the get)
|
||||
*/
|
||||
#define virAtomicIntGet(v) g_atomic_int_get(v)
|
||||
|
||||
/**
|
||||
* virAtomicIntSet:
|
||||
* Sets the value of atomic to newval.
|
||||
|
@ -154,7 +154,7 @@ virSystemdHasMachined(void)
|
||||
int ret;
|
||||
int val;
|
||||
|
||||
val = virAtomicIntGet(&virSystemdHasMachinedCachedValue);
|
||||
val = g_atomic_int_get(&virSystemdHasMachinedCachedValue);
|
||||
if (val != -1)
|
||||
return val;
|
||||
|
||||
@ -176,7 +176,7 @@ virSystemdHasLogind(void)
|
||||
int ret;
|
||||
int val;
|
||||
|
||||
val = virAtomicIntGet(&virSystemdHasLogindCachedValue);
|
||||
val = g_atomic_int_get(&virSystemdHasLogindCachedValue);
|
||||
if (val != -1)
|
||||
return val;
|
||||
|
||||
@ -352,7 +352,7 @@ int virSystemdCreateMachine(const char *name,
|
||||
*/
|
||||
|
||||
VIR_DEBUG("Attempting to create machine via systemd");
|
||||
if (virAtomicIntGet(&hasCreateWithNetwork)) {
|
||||
if (g_atomic_int_get(&hasCreateWithNetwork)) {
|
||||
virError error;
|
||||
memset(&error, 0, sizeof(error));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user