[gegl] [tile] Use g_atomic_int_inc and g_atomic_int_dec_and_test for refcount.



commit 2a1ea084c5d29819a1ac9c44d83272dd9dad11f5
Author: �yvind Kolås <pippin gimp org>
Date:   Sat Nov 21 22:32:43 2009 +0000

    [tile] Use g_atomic_int_inc and g_atomic_int_dec_and_test for refcount.

 gegl/buffer/gegl-tile.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 5014af4..3388ad2 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -45,14 +45,13 @@ static void default_free (gpointer data,
 
 GeglTile *gegl_tile_ref (GeglTile *tile)
 {
-  tile->ref_count++;
+  g_atomic_int_inc (&tile->ref_count);
   return tile;
 }
 
 void gegl_tile_unref (GeglTile *tile)
 {
-  tile->ref_count --;
-  if (tile->ref_count > 0)
+  if (!g_atomic_int_dec_and_test (&tile->ref_count))
     return;
 
   if (!gegl_tile_is_stored (tile))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]