diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2012-07-11 14:35:43 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2012-08-02 11:50:59 +0100 |
commit | 0c9fd4cfe98a90877ad8b974b28358127ea6cf43 (patch) | |
tree | f575aae5659782a72a376d489cdbcbce0154bb3b /.gitignore | |
parent | Remove manual one-shot global initializers (diff) | |
download | libvirt-0c9fd4cfe98a90877ad8b974b28358127ea6cf43.tar.gz libvirt-0c9fd4cfe98a90877ad8b974b28358127ea6cf43.tar.bz2 libvirt-0c9fd4cfe98a90877ad8b974b28358127ea6cf43.zip |
Rewrite virAtomic APIs using GLib's atomic ops code
There are a few issues with the current virAtomic APIs
- They require use of a virAtomicInt struct instead of a plain
int type
- Several of the methods do not implement memory barriers
- The methods do not implement compiler re-ordering barriers
- There is no Win32 native impl
The GLib library has a nice LGPLv2+ licensed impl of atomic
ops that works with GCC, Win32, or pthreads.h that addresses
all these problems. The main downside to their code is that
the pthreads impl uses a single global mutex, instead of
a per-variable mutex. Given that it does have a Win32 impl
though, we don't expect anyone to seriously use the pthread.h
impl, so this downside is not significant.
* .gitignore: Ignore test case
* configure.ac: Check for which atomic ops impl to use
* src/Makefile.am: Add viratomic.c
* src/nwfilter/nwfilter_dhcpsnoop.c: Switch to new atomic
ops APIs and plain int datatype
* src/util/viratomic.h: inline impls of all atomic ops
for GCC, Win32 and pthreads
* src/util/viratomic.c: Global pthreads mutex for atomic
ops
* tests/viratomictest.c: Test validate to validate safety
of atomic ops.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to '.gitignore')
-rw-r--r-- | .gitignore | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 5ea281a78..cd8a85ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -152,6 +152,7 @@ /tests/statstest /tests/storagebackendsheepdogtest /tests/utiltest +/tests/viratomictest /tests/virauthconfigtest /tests/virbuftest /tests/virdrivermoduletest |