gegl r2140 - in trunk: . gegl/buffer



Author: ok
Date: Sat Mar  1 20:45:10 2008
New Revision: 2140
URL: http://svn.gnome.org/viewvc/gegl?rev=2140&view=rev

Log:
* gegl/buffer/gegl-tile.[ch]: (dispose), (gegl_tile_new),
(gegl_tile_lock), (gegl_tile_unlock): Added a mutex being used when
writing to tiles.


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-tile.c
   trunk/gegl/buffer/gegl-tile.h

Modified: trunk/gegl/buffer/gegl-tile.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile.c	(original)
+++ trunk/gegl/buffer/gegl-tile.c	Sat Mar  1 20:45:10 2008
@@ -127,6 +127,14 @@
         }
     }
 
+#if ENABLE_MP
+    if (self->mutex)
+          {
+                g_mutex_free (self->mutex);
+                      self->mutex = NULL;
+                          }
+#endif
+
   (*G_OBJECT_CLASS (parent_class)->dispose)(object);
 }
 
@@ -203,6 +211,10 @@
   tile->size       = size;
   tile->stored_rev = 1;
 
+#if ENABLE_MP
+  tile->mutex = g_mutex_new ();
+#endif
+
   return tile;
 }
 
@@ -233,6 +245,11 @@
       g_warning ("locking a tile for the second time");
     }
   total_locks++;
+
+#if ENABLE_MT
+  g_mutex_lock (tile->mutex);
+#endif
+
   tile->lock++;
   /*fprintf (stderr, "global tile locking: %i %i\n", locks, unlocks);*/
 
@@ -319,6 +336,9 @@
       gegl_tile_void_pyramid (tile);
       tile->rev++;
     }
+#if ENABLE_MT
+  g_mutex_unlock (tile->mutex);
+#endif
 }
 
 

Modified: trunk/gegl/buffer/gegl-tile.h
==============================================================================
--- trunk/gegl/buffer/gegl-tile.h	(original)
+++ trunk/gegl/buffer/gegl-tile.h	Sat Mar  1 20:45:10 2008
@@ -57,6 +57,9 @@
   gchar          lock;        /* number of times the tile is write locked
                                * should in theory just have the values 0/1
                                */
+#if ENABLE_MP
+  GMutex        *mutex;
+#endif
 
   /* the shared list is a doubly linked circular list */
   GeglTile      *next_shared;



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