diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-10-31 13:19:09 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-11-10 13:09:50 +0100 |
commit | 9232d39e6a0738b750e97efd04124c81b7b2e583 (patch) | |
tree | 23b4bc3d39f0c6b16a55e8bc9df760e220f2c749 /src/provider.c | |
parent | 6bd851d905799dfb02e66eadc37c2e85b4b8f402 (diff) | |
download | connman-9232d39e6a0738b750e97efd04124c81b7b2e583.tar.gz connman-9232d39e6a0738b750e97efd04124c81b7b2e583.tar.bz2 connman-9232d39e6a0738b750e97efd04124c81b7b2e583.zip |
core: Use gcc atomics instead glib's ones
g_atomic_int_exchange_and_add() has been removed from glib 2.30
and g_atomic_int_add() should be used. Though there are still
quite a few distros out which do not ship a glib version with
g_atomic_int_add().
Instead of maintaing a compatiblilty glib layer we just use
the built-in functions for atomic memory access.
Diffstat (limited to 'src/provider.c')
-rw-r--r-- | src/provider.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/provider.c b/src/provider.c index 7b5edae3..27b09028 100644 --- a/src/provider.c +++ b/src/provider.c @@ -45,7 +45,7 @@ struct connman_route { }; struct connman_provider { - gint refcount; + int refcount; struct connman_service *vpn_service; int index; char *identifier; @@ -213,7 +213,7 @@ struct connman_provider *connman_provider_ref(struct connman_provider *provider) { DBG("provider %p refcount %d", provider, provider->refcount + 1); - g_atomic_int_inc(&provider->refcount); + __sync_fetch_and_add(&provider->refcount, 1); return provider; } @@ -235,7 +235,7 @@ void connman_provider_unref(struct connman_provider *provider) { DBG("provider %p refcount %d", provider, provider->refcount - 1); - if (g_atomic_int_dec_and_test(&provider->refcount) == FALSE) + if (__sync_fetch_and_sub(&provider->refcount, 1) != 1) return; provider_remove(provider); |