[glib/wip/resources] Make GResource refcount atomic
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/resources] Make GResource refcount atomic
- Date: Tue, 10 Jan 2012 14:09:05 +0000 (UTC)
commit d4ec3a8fd845b28a9bd4f573da05347a27f0c1f0
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jan 10 14:30:21 2012 +0100
Make GResource refcount atomic
gio/gresource.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gresource.c b/gio/gresource.c
index 56f4902..4beab46 100644
--- a/gio/gresource.c
+++ b/gio/gresource.c
@@ -64,14 +64,14 @@ g_resource_error_quark (void)
GResource *
g_resource_ref (GResource *resource)
{
- resource->ref_count++;
+ g_atomic_int_inc (&resource->ref_count);
return resource;
}
void
g_resource_unref (GResource *resource)
{
- if (resource->ref_count-- == 0)
+ if (g_atomic_int_dec_and_test (&resource->ref_count))
{
gvdb_table_unref (resource->table);
g_free (resource);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]