diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-10-31 13:19:11 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-11-10 13:09:50 +0100 |
commit | 1b45ea1b9fb70daa4b4a2905ebd9d12b9c7140d0 (patch) | |
tree | aa09d78b57d60b0829b1c017e2c58c9317d6d084 /gweb/gresolv.c | |
parent | 7042430b16001cdc85912aea5fcf64d255fcb5b3 (diff) | |
download | connman-1b45ea1b9fb70daa4b4a2905ebd9d12b9c7140d0.tar.gz connman-1b45ea1b9fb70daa4b4a2905ebd9d12b9c7140d0.tar.bz2 connman-1b45ea1b9fb70daa4b4a2905ebd9d12b9c7140d0.zip |
gweb: 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 'gweb/gresolv.c')
-rw-r--r-- | gweb/gresolv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gweb/gresolv.c b/gweb/gresolv.c index 326b5f94..6bfc20a4 100644 --- a/gweb/gresolv.c +++ b/gweb/gresolv.c @@ -97,7 +97,7 @@ struct resolv_nameserver { }; struct _GResolv { - gint ref_count; + int ref_count; int result_family; @@ -826,7 +826,7 @@ GResolv *g_resolv_ref(GResolv *resolv) if (resolv == NULL) return NULL; - g_atomic_int_inc(&resolv->ref_count); + __sync_fetch_and_add(&resolv->ref_count, 1); return resolv; } @@ -838,7 +838,7 @@ void g_resolv_unref(GResolv *resolv) if (resolv == NULL) return; - if (g_atomic_int_dec_and_test(&resolv->ref_count) == FALSE) + if (__sync_fetch_and_sub(&resolv->ref_count, 1) != 1) return; while ((query = g_queue_pop_head(resolv->query_queue))) |