]> xenbits.xensource.com Git - libvirt.git/commit
util: replace atomic ops impls with g_atomic_int*
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 9 Jan 2020 12:54:51 +0000 (12:54 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 17 Jan 2020 10:02:00 +0000 (10:02 +0000)
commit7b9645a7d127a374b8d1c83fdf9789706dbab2c9
treeae373604dfe1e26e75fac942428ba47c1d4ce22b
parent4f128bbbfb3dff18a3f89c9203dbeb089f9bea1a
util: replace atomic ops impls with g_atomic_int*

Libvirt's original atomic ops impls were largely copied
from GLib's code at the time. The only API difference
was that libvirt's virAtomicIntInc() would return a
value, but g_atomic_int_inc was void. We thus use
g_atomic_int_add(v, 1) instead, though this means
virAtomicIntInc() now returns the original value,
instead of the new value.

This rewrites libvirt's impl in terms of g_atomic_int*
as a short term conversion. The key motivation was to
quickly eliminate use of GNULIB's verify_expr() macro
which is not a direct match for G_STATIC_ASSERT_EXPR.
Long term all the callers should be updated to use
g_atomic_int* directly.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/libxl/libxl_domain.c
src/libxl/libxl_driver.c
src/lxc/lxc_process.c
src/nwfilter/nwfilter_dhcpsnoop.c
src/qemu/qemu_process.c
src/util/viratomic.h
src/util/virprocess.c
tests/viratomictest.c