[gegl] buffer: disable the locks on individual tiles



commit df2e43e1a68bd4c6cd05c87bc490fd4c09a4478c
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Thu Mar 29 01:54:32 2012 +0100

    buffer: disable the locks on individual tiles
    
    Disabled it with #ifdefs, we might want it back, for now we do not make use of
    it in neither GEGL or GeglBuffer.

 gegl/buffer/gegl-buffer-private.h |    6 ++++++
 gegl/buffer/gegl-tile.c           |   12 ++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-private.h b/gegl/buffer/gegl-buffer-private.h
index 6bc04a2..9e2e449 100644
--- a/gegl/buffer/gegl-buffer-private.h
+++ b/gegl/buffer/gegl-buffer-private.h
@@ -26,6 +26,8 @@
 #include "gegl-buffer-iterator.h"
 #include "gegl-buffer-cl-iterator.h"
 
+// #define GEGL_USE_TILE_MUTEX
+
 #define GEGL_BUFFER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_BUFFER, GeglBufferClass))
 #define GEGL_IS_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_BUFFER))
 #define GEGL_BUFFER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_BUFFER, GeglBufferClass))
@@ -151,7 +153,11 @@ struct _GeglTile
   gchar            lock;        /* number of times the tile is write locked
                                  * should in theory just have the values 0/1
                                  */
+
+
+#ifdef GEGL_USE_TILE_MUTEX
   GMutex          *mutex;
+#endif
 
   /* the shared list is a doubly linked circular list */
   GeglTile        *next_shared;
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 172cdb7..655923a 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -80,11 +80,13 @@ void gegl_tile_unref (GeglTile *tile)
         }
     }
 
+#ifdef GEGL_USE_TILE_MUTEX
   if (tile->mutex)
     {
       g_mutex_free (tile->mutex);
       tile->mutex = NULL;
     }
+#endif
   g_slice_free (GeglTile, tile);
 }
 
@@ -106,7 +108,9 @@ gegl_tile_new_bare (void)
   tile->destroy_notify = (void*)&free_data_directly;
   tile->destroy_notify_data = NULL;
 
+#ifdef GEGL_USE_TILE_MUTEX
   tile->mutex = g_mutex_new ();
+#endif
 
   return tile;
 }
@@ -126,15 +130,19 @@ gegl_tile_dup (GeglTile *src)
   tile->next_shared              = src->next_shared;
   src->next_shared               = tile;
   tile->prev_shared              = src;
+#ifdef GEGL_USE_TILE_MUTEX
   if (tile->next_shared != src)
     {
       g_mutex_lock (tile->next_shared->mutex);
     }
+#endif
   tile->next_shared->prev_shared = tile;
+#ifdef GEGL_USE_TILE_MUTEX
   if (tile->next_shared != src)
     {
       g_mutex_unlock (tile->next_shared->mutex);
     }
+#endif
 
   return tile;
 }
@@ -186,7 +194,9 @@ void gegl_bt (void);
 void
 gegl_tile_lock (GeglTile *tile)
 {
+#ifdef GEGL_USE_TILE_MUTEX
   g_mutex_lock (tile->mutex);
+#endif
 
   if (tile->lock != 0)
     {
@@ -254,7 +264,9 @@ gegl_tile_unlock (GeglTile *tile)
     }
   if (tile->lock==0)
     tile->rev++;
+#ifdef GEGL_USE_TILE_MUTEX
   g_mutex_unlock (tile->mutex);
+#endif
 }
 
 



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