[gegl] gegl: depend on GLib >= 2.32.4 and port to new mutex/cond API



commit 2bf9e4bb93db42e5a4434736e834facc6ad1f610
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 15 22:45:38 2013 +0100

    gegl: depend on GLib >= 2.32.4 and port to new mutex/cond API
    
    Fixes a ton of deprecation warnings.

 configure.ac                               |   14 +-----
 gegl/buffer/gegl-buffer-cl-cache.c         |   18 ++++----
 gegl/buffer/gegl-buffer-iterator.c         |   17 +++----
 gegl/buffer/gegl-buffer-linear.c           |    8 ++--
 gegl/buffer/gegl-buffer.c                  |   24 +++++-----
 gegl/buffer/gegl-cache.c                   |   20 ++++----
 gegl/buffer/gegl-cache.h                   |    2 +-
 gegl/buffer/gegl-tile-backend-file-async.c |   71 ++++++++++++++--------------
 gegl/buffer/gegl-tile-handler-cache.c      |   28 ++++++------
 gegl/buffer/gegl-tile-storage.c            |    4 +-
 gegl/buffer/gegl-tile-storage.h            |    2 +-
 gegl/buffer/gegl-tile.c                    |   10 ++--
 gegl/graph/gegl-node.c                     |   56 +++++++++++-----------
 gegl/graph/gegl-node.h                     |    2 +-
 gegl/operation/gegl-operation.c            |    4 +-
 gegl/process/gegl-have-visitor.c           |    4 +-
 gegl/process/gegl-prepare-visitor.c        |    8 ++--
 17 files changed, 139 insertions(+), 153 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c132b0b..f5dce14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ m4_define([gimp_full_name], [Generic Graphical Library])
 m4_define([babl_required_version], [0.1.10])
 m4_define([cairo_required_version], [0.0.0])
 m4_define([gdk_pixbuf_required_version], [2.18.0])
-m4_define([glib_required_version], [2.28.0])
+m4_define([glib_required_version], [2.32.4])
 m4_define([graphviz_required_version], [0.0.0])
 m4_define([jasper_required_version], [1.900.1])
 m4_define([lensfun_required_version], [0.2.5])
@@ -490,18 +490,6 @@ m4_ifdef([IT_PROG_INTLTOOL],[IT_PROG_INTLTOOL(0.40.1),],
 
 AM_GLIB_GNU_GETTEXT
 
-#########################
-# Disable deprecated APIs
-#########################
-
-AC_MSG_CHECKING([if GLib is version 2.21.0 or newer])
-if $PKG_CONFIG --atleast-version=2.21.0 glib-2.0; then
-  have_glib_2_21=yes
-else
-  have_glib_2_21=no
-fi
-AC_MSG_RESULT($have_glib_2_21)
-
 
 ######################################
 # Checks for gtk-doc and docbook-tools
diff --git a/gegl/buffer/gegl-buffer-cl-cache.c b/gegl/buffer/gegl-buffer-cl-cache.c
index 86842cf..10db36f 100644
--- a/gegl/buffer/gegl-buffer-cl-cache.c
+++ b/gegl/buffer/gegl-buffer-cl-cache.c
@@ -45,7 +45,7 @@ typedef struct
 
 static GList *cache_entries = NULL;
 
-static GStaticMutex cache_mutex = G_STATIC_MUTEX_INIT;
+static GMutex cache_mutex = { 0, };
 
 static gboolean
 cache_entry_find_invalid (gpointer *data)
@@ -108,7 +108,7 @@ gegl_buffer_cl_cache_new (GeglBuffer            *buffer,
                           const GeglRectangle   *roi,
                           cl_mem                 tex)
 {
-  g_static_mutex_lock (&cache_mutex);
+  g_mutex_lock (&cache_mutex);
 
   {
   CacheEntry *e = g_slice_new (CacheEntry);
@@ -123,7 +123,7 @@ gegl_buffer_cl_cache_new (GeglBuffer            *buffer,
   cache_entries = g_list_prepend (cache_entries, e);
   }
 
-  g_static_mutex_unlock (&cache_mutex);
+  g_mutex_unlock (&cache_mutex);
 }
 
 gboolean
@@ -171,7 +171,7 @@ gegl_buffer_cl_cache_flush2 (GeglTileHandlerCache *cache,
       cl_err = gegl_clFinish (gegl_cl_get_command_queue ());
       CL_CHECK;
 
-      g_static_mutex_lock (&cache_mutex);
+      g_mutex_lock (&cache_mutex);
 
       while (cache_entry_find_invalid (&data))
         {
@@ -190,14 +190,14 @@ gegl_buffer_cl_cache_flush2 (GeglTileHandlerCache *cache,
           cache_entries = g_list_remove (cache_entries, data);
         }
 
-      g_static_mutex_unlock (&cache_mutex);
+      g_mutex_unlock (&cache_mutex);
     }
 
   return TRUE;
 
 error:
 
-  g_static_mutex_lock (&cache_mutex);
+  g_mutex_lock (&cache_mutex);
 
   while (cache_entry_find_invalid (&data))
     {
@@ -205,7 +205,7 @@ error:
       cache_entries = g_list_remove (cache_entries, data);
     }
 
-  g_static_mutex_unlock (&cache_mutex);
+  g_mutex_unlock (&cache_mutex);
 
   /* XXX : result is corrupted */
   return FALSE;
@@ -238,7 +238,7 @@ gegl_buffer_cl_cache_invalidate (GeglBuffer          *buffer,
         }
     }
 
-  g_static_mutex_lock (&cache_mutex);
+  g_mutex_lock (&cache_mutex);
 
   while (cache_entry_find_invalid (&data))
     {
@@ -249,7 +249,7 @@ gegl_buffer_cl_cache_invalidate (GeglBuffer          *buffer,
       cache_entries = g_list_remove (cache_entries, data);
     }
 
-  g_static_mutex_unlock (&cache_mutex);
+  g_mutex_unlock (&cache_mutex);
 
 #if 0
   g_printf ("-- ");
diff --git a/gegl/buffer/gegl-buffer-iterator.c b/gegl/buffer/gegl-buffer-iterator.c
index ef435d9..61a341e 100644
--- a/gegl/buffer/gegl-buffer-iterator.c
+++ b/gegl/buffer/gegl-buffer-iterator.c
@@ -332,14 +332,13 @@ typedef struct BufInfo {
   gpointer buf;
 } BufInfo;
 
-static GArray *buf_pool = NULL;
-
-static GStaticMutex pool_mutex = G_STATIC_MUTEX_INIT;
+static GArray *buf_pool   = NULL;
+static GMutex  pool_mutex = { 0, };
 
 static gpointer iterator_buf_pool_get (gint size)
 {
   gint i;
-  g_static_mutex_lock (&pool_mutex);
+  g_mutex_lock (&pool_mutex);
 
   if (G_UNLIKELY (!buf_pool))
     {
@@ -351,7 +350,7 @@ static gpointer iterator_buf_pool_get (gint size)
       if (info->size >= size && info->used == 0)
         {
           info->used ++;
-          g_static_mutex_unlock (&pool_mutex);
+          g_mutex_unlock (&pool_mutex);
           return info->buf;
         }
     }
@@ -360,7 +359,7 @@ static gpointer iterator_buf_pool_get (gint size)
     info.size = size;
     info.buf = gegl_malloc (size);
     g_array_append_val (buf_pool, info);
-    g_static_mutex_unlock (&pool_mutex);
+    g_mutex_unlock (&pool_mutex);
     return info.buf;
   }
 }
@@ -368,19 +367,19 @@ static gpointer iterator_buf_pool_get (gint size)
 static void iterator_buf_pool_release (gpointer buf)
 {
   gint i;
-  g_static_mutex_lock (&pool_mutex);
+  g_mutex_lock (&pool_mutex);
   for (i=0; i<buf_pool->len; i++)
     {
       BufInfo *info = &g_array_index (buf_pool, BufInfo, i);
       if (info->buf == buf)
         {
           info->used --;
-          g_static_mutex_unlock (&pool_mutex);
+          g_mutex_unlock (&pool_mutex);
           return;
         }
     }
   g_assert (0);
-  g_static_mutex_unlock (&pool_mutex);
+  g_mutex_unlock (&pool_mutex);
 }
 
 static void ensure_buf (GeglBufferIterators *i, gint no)
diff --git a/gegl/buffer/gegl-buffer-linear.c b/gegl/buffer/gegl-buffer-linear.c
index 27970c5..1d64412 100644
--- a/gegl/buffer/gegl-buffer-linear.c
+++ b/gegl/buffer/gegl-buffer-linear.c
@@ -137,7 +137,7 @@ gegl_buffer_linear_open (GeglBuffer          *buffer,
     extent=&buffer->extent;
 
   /*gegl_buffer_lock (buffer);*/
-  g_mutex_lock (buffer->tile_storage->mutex);
+  g_mutex_lock (&buffer->tile_storage->mutex);
   if (extent->x     == buffer->extent.x &&
       extent->y     == buffer->extent.y &&
       extent->width == buffer->tile_width &&
@@ -248,19 +248,19 @@ gegl_buffer_linear_close (GeglBuffer *buffer,
               linear_buffers = g_list_remove (linear_buffers, info);
               g_object_set_data (G_OBJECT (buffer), "linear-buffers", linear_buffers);
 
-              g_mutex_unlock (buffer->tile_storage->mutex);
+              g_mutex_unlock (&buffer->tile_storage->mutex);
               /* XXX: potential race */
               gegl_buffer_set (buffer, &info->extent, 0, info->format, info->buf, 0);
 
               gegl_free (info->buf);
               g_free (info);
 
-              g_mutex_lock (buffer->tile_storage->mutex);
+              g_mutex_lock (&buffer->tile_storage->mutex);
               break;
             }
         }
     }
   /*gegl_buffer_unlock (buffer);*/
-  g_mutex_unlock (buffer->tile_storage->mutex);
+  g_mutex_unlock (&buffer->tile_storage->mutex);
   return;
 }
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index ec4537c..b55aa2d 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -1195,7 +1195,7 @@ typedef struct TileStorageCacheItem {
   const void      *babl_fmt;
 } TileStorageCacheItem;
 
-static GStaticMutex storage_cache_mutex = G_STATIC_MUTEX_INIT;
+static GMutex  storage_cache_mutex = { 0, };
 static GSList *storage_cache = NULL;
 
 /* returns TRUE if it could be done */
@@ -1206,22 +1206,22 @@ gboolean gegl_tile_storage_cached_release (GeglTileStorage *storage)
 
   if (!item)
     return FALSE;
-  g_static_mutex_lock (&storage_cache_mutex);
+  g_mutex_lock (&storage_cache_mutex);
   storage_cache = g_slist_prepend (storage_cache, item);
-  g_static_mutex_unlock (&storage_cache_mutex);
+  g_mutex_unlock (&storage_cache_mutex);
   return TRUE;
 }
 
 void gegl_tile_storage_cache_cleanup (void);
 void gegl_tile_storage_cache_cleanup (void)
 {
-  g_static_mutex_lock (&storage_cache_mutex);
+  g_mutex_lock (&storage_cache_mutex);
   for (;storage_cache; storage_cache = g_slist_remove (storage_cache, storage_cache->data))
     {
       TileStorageCacheItem *item = storage_cache->data;
       g_object_unref (item->storage);
     }
-  g_static_mutex_unlock (&storage_cache_mutex);
+  g_mutex_unlock (&storage_cache_mutex);
 }
 
 static GeglTileStorage *
@@ -1230,7 +1230,7 @@ gegl_tile_storage_new_cached (gint tile_width, gint tile_height,
 {
   GeglTileStorage *storage = NULL;
   GSList *iter;
-  g_static_mutex_lock (&storage_cache_mutex);
+  g_mutex_lock (&storage_cache_mutex);
   for (iter = storage_cache; iter; iter = iter->next)
     {
       TileStorageCacheItem *item = iter->data;
@@ -1303,7 +1303,7 @@ gegl_tile_storage_new_cached (gint tile_width, gint tile_height,
       g_object_set_data_full (G_OBJECT (storage), "storage-cache-item", item, g_free);
     }
 
-  g_static_mutex_unlock (&storage_cache_mutex);
+  g_mutex_unlock (&storage_cache_mutex);
   return storage;
 }
 
@@ -1380,11 +1380,11 @@ gboolean gegl_buffer_try_lock (GeglBuffer *buffer)
 {
   gboolean ret;
   GeglTileBackend *backend = gegl_buffer_backend (buffer);
-  g_mutex_lock (buffer->tile_storage->mutex);
+  g_mutex_lock (&buffer->tile_storage->mutex);
   if (buffer->lock_count>0)
     {
       buffer->lock_count++;
-      g_mutex_unlock (buffer->tile_storage->mutex);
+      g_mutex_unlock (&buffer->tile_storage->mutex);
       return TRUE;
     }
   if (gegl_buffer_is_shared(buffer))
@@ -1393,7 +1393,7 @@ gboolean gegl_buffer_try_lock (GeglBuffer *buffer)
     ret = TRUE;
   if (ret)
     buffer->lock_count++;
-  g_mutex_unlock (buffer->tile_storage->mutex);
+  g_mutex_unlock (&buffer->tile_storage->mutex);
   return TRUE;
 }
 
@@ -1412,7 +1412,7 @@ gboolean gegl_buffer_unlock (GeglBuffer *buffer)
 {
   gboolean ret = TRUE;
   GeglTileBackend *backend = gegl_buffer_backend (buffer);
-  g_mutex_lock (buffer->tile_storage->mutex);
+  g_mutex_lock (&buffer->tile_storage->mutex);
   g_assert (buffer->lock_count >=0);
   buffer->lock_count--;
   g_assert (buffer->lock_count >=0);
@@ -1420,7 +1420,7 @@ gboolean gegl_buffer_unlock (GeglBuffer *buffer)
     {
       ret = gegl_tile_backend_file_unlock (GEGL_TILE_BACKEND_FILE (backend));
     }
-  g_mutex_unlock (buffer->tile_storage->mutex);
+  g_mutex_unlock (&buffer->tile_storage->mutex);
   return ret;
 }
 
diff --git a/gegl/buffer/gegl-cache.c b/gegl/buffer/gegl-cache.c
index 8e2c920..5373ed0 100644
--- a/gegl/buffer/gegl-cache.c
+++ b/gegl/buffer/gegl-cache.c
@@ -192,7 +192,7 @@ static void
 gegl_cache_init (GeglCache *self)
 {
   self->node = NULL;
-  self->mutex = g_mutex_new ();
+  g_mutex_init (&self->mutex);
 
   /* thus providing a default value for GeglCache, that overrides the NULL
    * from GeglBuffer */
@@ -230,7 +230,7 @@ finalize (GObject *gobject)
 {
   GeglCache *self = GEGL_CACHE (gobject);
 
-  g_mutex_free (self->mutex);
+  g_mutex_clear (&self->mutex);
   if (self->valid_region)
     gegl_region_destroy (self->valid_region);
   G_OBJECT_CLASS (gegl_cache_parent_class)->finalize (gobject);
@@ -251,9 +251,9 @@ node_invalidated (GeglNode            *source,
     gegl_region_destroy (region);
   }
 
-  g_mutex_lock (cache->mutex);
+  g_mutex_lock (&cache->mutex);
   g_signal_emit_by_name (cache, "invalidated", &expanded, NULL);
-  g_mutex_unlock (cache->mutex);
+  g_mutex_unlock (&cache->mutex);
 }
 
 static void
@@ -267,7 +267,7 @@ set_property (GObject      *gobject,
   switch (property_id)
     {
       case PROP_NODE:
-        g_mutex_lock (self->mutex);
+        g_mutex_lock (&self->mutex);
         if (self->node)
           {
             gulong handler;
@@ -286,7 +286,7 @@ set_property (GObject      *gobject,
         self->node = GEGL_NODE (g_value_get_object (value));
         g_signal_connect (G_OBJECT (self->node), "invalidated",
                           G_CALLBACK (node_invalidated), self);
-        g_mutex_unlock (self->mutex);
+        g_mutex_unlock (&self->mutex);
         break;
 
       case PROP_X:
@@ -384,7 +384,7 @@ gegl_cache_invalidate (GeglCache           *self,
     }
 #endif
 
-  g_mutex_lock (self->mutex);
+  g_mutex_lock (&self->mutex);
 
   if (roi)
     {
@@ -406,7 +406,7 @@ gegl_cache_invalidate (GeglCache           *self,
       g_signal_emit (self, gegl_cache_signals[INVALIDATED], 0,
                      &rect, NULL);
     }
-  g_mutex_unlock (self->mutex);
+  g_mutex_unlock (&self->mutex);
 }
 
 void
@@ -416,8 +416,8 @@ gegl_cache_computed (GeglCache           *self,
   g_return_if_fail (GEGL_IS_CACHE (self));
   g_return_if_fail (rect != NULL);
 
-  g_mutex_lock (self->mutex);
+  g_mutex_lock (&self->mutex);
   gegl_region_union_with_rect (self->valid_region, rect);
   g_signal_emit (self, gegl_cache_signals[COMPUTED], 0, rect, NULL);
-  g_mutex_unlock (self->mutex);
+  g_mutex_unlock (&self->mutex);
 }
diff --git a/gegl/buffer/gegl-cache.h b/gegl/buffer/gegl-cache.h
index 4f00ae9..950182b 100644
--- a/gegl/buffer/gegl-cache.h
+++ b/gegl/buffer/gegl-cache.h
@@ -40,7 +40,7 @@ struct _GeglCache
   GeglNode     *node;
   const void   *format;
   GeglRegion   *valid_region;
-  GMutex       *mutex;
+  GMutex        mutex;
 };
 
 struct _GeglCacheClass
diff --git a/gegl/buffer/gegl-tile-backend-file-async.c b/gegl/buffer/gegl-tile-backend-file-async.c
index 9686f9a..e213d9f 100644
--- a/gegl/buffer/gegl-tile-backend-file-async.c
+++ b/gegl/buffer/gegl-tile-backend-file-async.c
@@ -127,7 +127,7 @@ struct _GeglTileBackendFile
   gint             pending_ops;
 
   /* used for waiting on writes to the file to be finished */
-  GCond           *cond;
+  GCond            cond;
 
   /* for writing */
   int              o;
@@ -155,19 +155,19 @@ static gint peak_allocs    = 0;
 static gint peak_file_size = 0;
 
 static GQueue  queue      = G_QUEUE_INIT;
-static GMutex *mutex      = NULL;
-static GCond  *queue_cond = NULL;
-static GCond  *max_cond   = NULL;
+static GMutex  mutex      = { 0, };
+static GCond   queue_cond = { 0, };
+static GCond   max_cond   = { 0, };
 static GeglFileBackendThreadParams *in_progress;
 
 
 static void
 gegl_tile_backend_file_finish_writing (GeglTileBackendFile *self)
 {
-  g_mutex_lock (mutex);
+  g_mutex_lock (&mutex);
   while (self->pending_ops != 0)
-    g_cond_wait (self->cond, mutex);
-  g_mutex_unlock (mutex);
+    g_cond_wait (&self->cond, &mutex);
+  g_mutex_unlock (&mutex);
 }
 
 static void
@@ -175,13 +175,13 @@ gegl_tile_backend_file_push_queue (GeglFileBackendThreadParams *params)
 {
   guint length;
 
-  g_mutex_lock (mutex);
+  g_mutex_lock (&mutex);
 
   length = g_queue_get_length (&queue);
 
   /* block if the queue has gotten too big */
   if (length > gegl_config ()->queue_limit)
-    g_cond_wait (max_cond, mutex);
+    g_cond_wait (&max_cond, &mutex);
 
   params->file->pending_ops += 1;
   g_queue_push_tail (&queue, params);
@@ -195,9 +195,9 @@ gegl_tile_backend_file_push_queue (GeglFileBackendThreadParams *params)
     }
 
   /* wake up the writer thread */
-  g_cond_signal (queue_cond);
+  g_cond_signal (&queue_cond);
 
-  g_mutex_unlock (mutex);
+  g_mutex_unlock (&mutex);
 }
 
 static inline void
@@ -245,10 +245,10 @@ gegl_tile_backend_file_writer_thread (gpointer ignored)
     {
       GeglFileBackendThreadParams *params;
 
-      g_mutex_lock (mutex);
+      g_mutex_lock (&mutex);
 
       while (g_queue_is_empty (&queue))
-        g_cond_wait (queue_cond, mutex);
+        g_cond_wait (&queue_cond, &mutex);
 
       params = (GeglFileBackendThreadParams *)g_queue_pop_head (&queue);
       if (params->entry)
@@ -259,7 +259,7 @@ gegl_tile_backend_file_writer_thread (gpointer ignored)
           else /* OP_WRITE_BLOCK */
             params->entry->block_link = NULL;
         }
-      g_mutex_unlock (mutex);
+      g_mutex_unlock (&mutex);
 
       switch (params->operation)
         {
@@ -277,24 +277,24 @@ gegl_tile_backend_file_writer_thread (gpointer ignored)
           break;
         }
 
-      g_mutex_lock (mutex);
+      g_mutex_lock (&mutex);
       in_progress = NULL;
 
       /* the file maybe waiting for its file operations to finish */
       params->file->pending_ops -= 1;
       if (params->file->pending_ops == 0)
-        g_cond_signal (params->file->cond);
+        g_cond_signal (&params->file->cond);
 
       /* unblock the main thread if the queue had gotten too big */
       if (g_queue_get_length (&queue) < gegl_config ()->queue_limit)
-        g_cond_signal (max_cond);
+        g_cond_signal (&max_cond);
 
       if (params->source)
         g_free (params->source);
 
       g_free (params);
 
-      g_mutex_unlock (mutex);
+      g_mutex_unlock (&mutex);
     }
 
   return NULL;
@@ -314,7 +314,7 @@ gegl_tile_backend_file_entry_read (GeglTileBackendFile  *self,
   if (entry->tile_link || in_progress)
     {
       GeglFileBackendThreadParams *queued_op = NULL;
-      g_mutex_lock (mutex);
+      g_mutex_lock (&mutex);
 
       if (entry->tile_link)
         queued_op = entry->tile_link->data;
@@ -325,14 +325,14 @@ gegl_tile_backend_file_entry_read (GeglTileBackendFile  *self,
       if (queued_op)
         {
           memcpy (dest, queued_op->source, to_be_read);
-          g_mutex_unlock (mutex);
+          g_mutex_unlock (&mutex);
 
           GEGL_NOTE (GEGL_DEBUG_TILE_BACKEND, "read entry %i,%i,%i from queue", entry->tile->x, 
entry->tile->y, entry->tile->z);
 
           return;
         }
 
-      g_mutex_unlock (mutex);
+      g_mutex_unlock (&mutex);
     }
 
   if (self->in_offset != offset)
@@ -378,20 +378,20 @@ gegl_tile_backend_file_entry_write (GeglTileBackendFile  *self,
 
   if (entry->tile_link)
     {
-      g_mutex_lock (mutex);
+      g_mutex_lock (&mutex);
 
       if (entry->tile_link)
         {
           params = entry->tile_link->data;
           memcpy (params->source, source, length);
-          g_mutex_unlock (mutex);
+          g_mutex_unlock (&mutex);
 
           GEGL_NOTE (GEGL_DEBUG_TILE_BACKEND, "overwrote queue entry %i,%i,%i at %i", entry->tile->x, 
entry->tile->y, entry->tile->z, (gint)entry->tile->offset);
 
           return;
         }
 
-      g_mutex_unlock (mutex);
+      g_mutex_unlock (&mutex);
     }
 
   new_source = g_malloc (length);
@@ -484,7 +484,7 @@ gegl_tile_backend_file_file_entry_destroy (GeglTileBackendFile  *self,
       gint   i;
       GList *link;
 
-      g_mutex_lock (mutex);
+      g_mutex_lock (&mutex);
 
       for (i = 0, link = entry->tile_link;
            i < 2;
@@ -500,7 +500,7 @@ gegl_tile_backend_file_file_entry_destroy (GeglTileBackendFile  *self,
             }
         }
 
-      g_mutex_unlock (mutex);
+      g_mutex_unlock (&mutex);
     }
 
   self->free_list = g_slist_prepend (self->free_list, offset);
@@ -567,14 +567,14 @@ gegl_tile_backend_file_write_block (GeglTileBackendFile  *self,
 
       if (self->in_holding->block_link)
         {
-          g_mutex_lock (mutex);
+          g_mutex_lock (&mutex);
 
           if (self->in_holding->block_link)
             {
               params = self->in_holding->block_link->data;
               params->offset = self->offset;
               memcpy (params->source, block, length);
-              g_mutex_unlock (mutex);
+              g_mutex_unlock (&mutex);
 
               self->offset = next_allocation;
               self->in_holding = item;
@@ -586,7 +586,7 @@ gegl_tile_backend_file_write_block (GeglTileBackendFile  *self,
               return TRUE;
             }
 
-          g_mutex_unlock (mutex);
+          g_mutex_unlock (&mutex);
         }
 
       params     = g_new0 (GeglFileBackendThreadParams, 1);
@@ -965,10 +965,9 @@ gegl_tile_backend_file_finalize (GObject *object)
   if (self->file)
     g_object_unref (self->file);
 
-  if (self->cond)
-    g_cond_free (self->cond);
+  g_cond_clear (&self->cond);
 
-  (*G_OBJECT_CLASS (parent_class)->finalize)(object);
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static guint
@@ -1142,7 +1141,7 @@ gegl_tile_backend_file_constructor (GType                  type,
   self->index       = g_hash_table_new (gegl_tile_backend_file_hashfunc,
                                         gegl_tile_backend_file_equalfunc);
   self->pending_ops = 0;
-  self->cond        = g_cond_new ();
+  g_cond_init (&self->cond);
 
   /* If the file already exists open it, assuming it is a GeglBuffer. */
   if (g_access (self->path, F_OK) != -1)
@@ -1255,9 +1254,9 @@ gegl_tile_backend_file_class_init (GeglTileBackendFileClass *klass)
   gobject_class->constructor  = gegl_tile_backend_file_constructor;
   gobject_class->finalize     = gegl_tile_backend_file_finalize;
 
-  queue_cond = g_cond_new ();
-  max_cond   = g_cond_new ();
-  mutex      = g_mutex_new ();
+  g_cond_init (&queue_cond);
+  g_cond_init (&max_cond);
+  g_mutex_init (&mutex);
   g_thread_create_full (gegl_tile_backend_file_writer_thread,
                         NULL, 0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL);
 
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index 62c6298..9bb1d14 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -84,7 +84,7 @@ static void       gegl_tile_handler_cache_invalidate (GeglTileHandlerCache *cach
                                                       gint                  z);
 
 
-static GStaticMutex mutex                 = G_STATIC_MUTEX_INIT;
+static GMutex       mutex                 = { 0, };
 static GQueue      *cache_queue           = NULL;
 static GHashTable  *cache_ht              = NULL;
 static gint         cache_wash_percentage = 20;
@@ -142,7 +142,7 @@ gegl_tile_handler_cache_reinit (GeglTileHandlerCache *cache)
   if (!cache->count)
     return;
 
-  g_static_mutex_lock (&mutex);
+  g_mutex_lock (&mutex);
   /* only throw out items belonging to this cache instance */
 
   cache->free_list = NULL;
@@ -163,7 +163,7 @@ gegl_tile_handler_cache_reinit (GeglTileHandlerCache *cache)
     }
   g_slist_free (cache->free_list);
   cache->free_list = NULL;
-  g_static_mutex_unlock (&mutex);
+  g_mutex_unlock (&mutex);
 }
 
 static void
@@ -198,7 +198,7 @@ gegl_tile_handler_cache_dispose (GObject *object)
 
   if (cache->count)
     {
-      g_static_mutex_lock (&mutex);
+      g_mutex_lock (&mutex);
       g_queue_foreach (cache_queue, gegl_tile_handler_cache_dispose_buffer_tiles, cache);
       for (iter = cache->free_list; iter; iter = g_slist_next (iter))
         {
@@ -215,7 +215,7 @@ gegl_tile_handler_cache_dispose (GObject *object)
         }
       g_slist_free (cache->free_list);
       cache->free_list = NULL;
-      g_static_mutex_unlock (&mutex);
+      g_mutex_unlock (&mutex);
     }
 
   if (cache->count < 0)
@@ -396,16 +396,16 @@ gegl_tile_handler_cache_get_tile (GeglTileHandlerCache *cache,
   if (cache->count == 0)
     return NULL;
 
-  g_static_mutex_lock (&mutex);
+  g_mutex_lock (&mutex);
   result = cache_lookup (cache, x, y, z);
   if (result)
     {
       g_queue_unlink (cache_queue, &result->link);
       g_queue_push_head_link (cache_queue, &result->link);
-      g_static_mutex_unlock (&mutex);
+      g_mutex_unlock (&mutex);
       return gegl_tile_ref (result->tile);
     }
-  g_static_mutex_unlock (&mutex);
+  g_mutex_unlock (&mutex);
   return NULL;
 }
 
@@ -455,7 +455,7 @@ gegl_tile_handler_cache_invalidate (GeglTileHandlerCache *cache,
 {
   CacheItem *item;
 
-  g_static_mutex_lock (&mutex);
+  g_mutex_lock (&mutex);
   item = cache_lookup (cache, x, y, z);
   if (item)
     {
@@ -467,7 +467,7 @@ gegl_tile_handler_cache_invalidate (GeglTileHandlerCache *cache,
       g_hash_table_remove (cache_ht, item);
       g_slice_free (CacheItem, item);
     }
-  g_static_mutex_unlock (&mutex);
+  g_mutex_unlock (&mutex);
 }
 
 
@@ -479,7 +479,7 @@ gegl_tile_handler_cache_void (GeglTileHandlerCache *cache,
 {
   CacheItem *item;
 
-  g_static_mutex_lock (&mutex);
+  g_mutex_lock (&mutex);
   item = cache_lookup (cache, x, y, z);
   if (item)
     {
@@ -491,7 +491,7 @@ gegl_tile_handler_cache_void (GeglTileHandlerCache *cache,
       g_slice_free (CacheItem, item);
       cache->count --;
     }
-  g_static_mutex_unlock (&mutex);
+  g_mutex_unlock (&mutex);
 }
 
 void
@@ -515,7 +515,7 @@ gegl_tile_handler_cache_insert (GeglTileHandlerCache *cache,
   // XXX : remove entry if it already exists
   gegl_tile_handler_cache_void (cache, x, y, z);
 
-  g_static_mutex_lock (&mutex);
+  g_mutex_lock (&mutex);
   cache_total  += item->tile->size;
   g_queue_push_head_link (cache_queue, &item->link);
 
@@ -532,7 +532,7 @@ gegl_tile_handler_cache_insert (GeglTileHandlerCache *cache,
 #endif
       gegl_tile_handler_cache_trim (cache);
     }
-  g_static_mutex_unlock (&mutex);
+  g_mutex_unlock (&mutex);
 }
 
 GeglTileHandler *
diff --git a/gegl/buffer/gegl-tile-storage.c b/gegl/buffer/gegl-tile-storage.c
index db1a369..875f1c4 100644
--- a/gegl/buffer/gegl-tile-storage.c
+++ b/gegl/buffer/gegl-tile-storage.c
@@ -78,7 +78,7 @@ gegl_tile_storage_new (GeglTileBackend *backend)
   GeglTileHandler       *zoom = NULL;
 
   tile_storage->seen_zoom = 0;
-  tile_storage->mutex = g_mutex_new ();
+  g_mutex_init (&tile_storage->mutex);
   tile_storage->width = G_MAXINT;
   tile_storage->height = G_MAXINT;
 
@@ -167,7 +167,7 @@ gegl_tile_storage_finalize (GObject *object)
 
   if (self->path)
     g_free (self->path);
-  g_mutex_free (self->mutex);
+  g_mutex_clear (&self->mutex);
 
   (*G_OBJECT_CLASS (parent_class)->finalize)(object);
 }
diff --git a/gegl/buffer/gegl-tile-storage.h b/gegl/buffer/gegl-tile-storage.h
index 97e2368..c9552b3 100644
--- a/gegl/buffer/gegl-tile-storage.h
+++ b/gegl/buffer/gegl-tile-storage.h
@@ -40,7 +40,7 @@ struct _GeglTileStorage
 {
   GeglTileHandlerChain parent_instance;
   GeglTileHandlerCache *cache;
-  GMutex        *mutex;
+  GMutex         mutex;
   const Babl    *format;
   gint           tile_width;
   gint           tile_height;
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 2cc9bd1..1be57b7 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -39,7 +39,7 @@
 
 #include "gegl-utils.h"
 
-static GStaticMutex cowmutex = G_STATIC_MUTEX_INIT;
+static GMutex cowmutex = { 0, };
 
 GeglTile *gegl_tile_ref (GeglTile *tile)
 {
@@ -123,14 +123,14 @@ gegl_tile_dup (GeglTile *src)
 
   if (tile->next_shared != src)
     {
-      g_static_mutex_lock (&cowmutex);
+      g_mutex_lock (&cowmutex);
     }
 
   tile->next_shared->prev_shared = tile;
 
   if (tile->next_shared != src)
     {
-      g_static_mutex_unlock (&cowmutex);
+      g_mutex_unlock (&cowmutex);
     }
 
   return tile;
@@ -164,7 +164,7 @@ gegl_tile_unclone (GeglTile *tile)
       /* the tile data is shared with other tiles,
        * create a local copy
        */
-      g_static_mutex_lock (&cowmutex);
+      g_mutex_lock (&cowmutex);
       tile->data                     = gegl_memdup (tile->data, tile->size);
       tile->destroy_notify           = (void*)&free_data_directly;
       tile->destroy_notify_data      = NULL;
@@ -172,7 +172,7 @@ gegl_tile_unclone (GeglTile *tile)
       tile->next_shared->prev_shared = tile->prev_shared;
       tile->prev_shared              = tile;
       tile->next_shared              = tile;
-      g_static_mutex_unlock (&cowmutex);
+      g_mutex_unlock (&cowmutex);
     }
 }
 
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index e735759..1a7d507 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -193,13 +193,13 @@ gegl_node_init (GeglNode *self)
 
   self->priv->contexts = g_hash_table_new (NULL, NULL);
 
-  self->pads           = NULL;
-  self->input_pads     = NULL;
-  self->output_pads    = NULL;
-  self->operation      = NULL;
-  self->is_graph       = FALSE;
-  self->cache          = NULL;
-  self->mutex          = g_mutex_new ();
+  self->pads        = NULL;
+  self->input_pads  = NULL;
+  self->output_pads = NULL;
+  self->operation   = NULL;
+  self->is_graph    = FALSE;
+  self->cache       = NULL;
+  g_mutex_init (&self->mutex);
 
 }
 
@@ -279,7 +279,7 @@ gegl_node_finalize (GObject *gobject)
       g_free (self->priv->name);
     }
   g_hash_table_destroy (self->priv->contexts);
-  g_mutex_free (self->mutex);
+  g_mutex_clear (&self->mutex);
 
   G_OBJECT_CLASS (gegl_node_parent_class)->finalize (gobject);
 }
@@ -917,10 +917,10 @@ typedef struct ThreadData
   GeglBlitFlags        flags;
 } ThreadData;
 
-static GThreadPool *pool = NULL;
-static GMutex *mutex = NULL;
-static GCond  *cond = NULL;
-static gint    remaining_tasks = 0;
+static GThreadPool *pool            = NULL;
+static GMutex       mutex           = { 0, };
+static GCond        cond            = { 0, };
+static gint         remaining_tasks = 0;
 
 static void spawnrender (gpointer data,
                          gpointer foo)
@@ -939,14 +939,14 @@ static void spawnrender (gpointer data,
   if (buffer)
     g_object_unref (buffer);
 
-  g_mutex_lock (mutex);
+  g_mutex_lock (&mutex);
   remaining_tasks --;
   if (remaining_tasks == 0)
     {
       /* we were the last task, we're not busy rendering any more */
-      g_cond_signal (cond);
+      g_cond_signal (&cond);
     }
-  g_mutex_unlock (mutex);
+  g_mutex_unlock (&mutex);
 }
 
 
@@ -970,8 +970,8 @@ gegl_node_blit (GeglNode            *self,
   if (pool == NULL)
     {
       pool = g_thread_pool_new (spawnrender, NULL, threads, TRUE, NULL);
-      mutex = g_mutex_new ();
-      cond = g_cond_new ();
+      g_mutex_init (&mutex);
+      g_cond_init (&cond);
     }
 
   if (flags == GEGL_BLIT_DEFAULT)
@@ -1045,10 +1045,10 @@ gegl_node_blit (GeglNode            *self,
             g_thread_pool_push (pool, &data[i], NULL);
           spawnrender (&data[threads-1], NULL);
 
-          g_mutex_lock (mutex);
+          g_mutex_lock (&mutex);
           while (remaining_tasks!=0)
-            g_cond_wait (cond, mutex);
-          g_mutex_unlock (mutex);
+            g_cond_wait (&cond, &mutex);
+          g_mutex_unlock (&mutex);
         }
     }
 #else /* thread free version, could be removed, left behind in case it
@@ -1834,10 +1834,10 @@ gegl_node_get_context (GeglNode *self,
                        gpointer  context_id)
 {
   GeglOperationContext *context = NULL;
-  //g_mutex_lock (self->mutex);
+  //g_mutex_lock (&self->mutex);
 
   context = g_hash_table_lookup (self->priv->contexts, context_id);
-  //g_mutex_unlock (self->mutex);
+  //g_mutex_unlock (&self->mutex);
   return context;
 }
 
@@ -1851,17 +1851,17 @@ gegl_node_remove_context (GeglNode *self,
   g_return_if_fail (context_id != NULL);
 
   context = gegl_node_get_context (self, context_id);
-  g_mutex_lock (self->mutex);
+  g_mutex_lock (&self->mutex);
   if (!context)
     {
       g_warning ("didn't find context %p for %s",
                  context_id, gegl_node_get_debug_name (self));
-      g_mutex_unlock (self->mutex);
+      g_mutex_unlock (&self->mutex);
       return;
     }
   g_hash_table_remove (self->priv->contexts, context_id);
   gegl_operation_context_destroy (context);
-  g_mutex_unlock (self->mutex);
+  g_mutex_unlock (&self->mutex);
 }
 
 /* Creates, sets up and returns a new context for the node, or just returns it
@@ -1876,21 +1876,21 @@ gegl_node_add_context (GeglNode *self,
   g_return_val_if_fail (GEGL_IS_NODE (self), NULL);
   g_return_val_if_fail (context_id != NULL, NULL);
 
-  g_mutex_lock (self->mutex);
+  g_mutex_lock (&self->mutex);
   context = g_hash_table_lookup (self->priv->contexts, context_id);
 
   if (context)
     {
       /* silently ignore, since multiple traversals of prepare are done
        * to saturate the graph */
-      g_mutex_unlock (self->mutex);
+      g_mutex_unlock (&self->mutex);
       return context;
     }
 
   context             = gegl_operation_context_new ();
   context->operation  = self->operation;
   g_hash_table_insert (self->priv->contexts, context_id, context);
-  g_mutex_unlock (self->mutex);
+  g_mutex_unlock (&self->mutex);
   return context;
 }
 
diff --git a/gegl/graph/gegl-node.h b/gegl/graph/gegl-node.h
index 46a7b35..76c9f42 100644
--- a/gegl/graph/gegl-node.h
+++ b/gegl/graph/gegl-node.h
@@ -75,7 +75,7 @@ struct _GeglNode
   /* Whether result is cached or not, inherited by children */
   gboolean        dont_cache;
 
-  GMutex         *mutex;
+  GMutex          mutex;
 
   /*< private >*/
   GeglNodePrivate *priv;
diff --git a/gegl/operation/gegl-operation.c b/gegl/operation/gegl-operation.c
index b03d17f..5d22cf5 100644
--- a/gegl/operation/gegl-operation.c
+++ b/gegl/operation/gegl-operation.c
@@ -341,9 +341,9 @@ gegl_operation_source_get_bounding_box (GeglOperation *operation,
   if (node)
     {
       GeglRectangle *ret;
-      g_mutex_lock (node->mutex);
+      g_mutex_lock (&node->mutex);
       ret = &node->have_rect;
-      g_mutex_unlock (node->mutex);
+      g_mutex_unlock (&node->mutex);
       return ret;
     }
 
diff --git a/gegl/process/gegl-have-visitor.c b/gegl/process/gegl-have-visitor.c
index 4fd5a88..950a8bc 100644
--- a/gegl/process/gegl-have-visitor.c
+++ b/gegl/process/gegl-have-visitor.c
@@ -64,7 +64,7 @@ gegl_have_visitor_visit_node (GeglVisitor *self,
   if (!node)
     return;
   operation = node->operation;
-  g_mutex_lock (node->mutex);
+  g_mutex_lock (&node->mutex);
   node->have_rect = gegl_operation_get_bounding_box (operation);
   /*
    * Setting cache dimensions here helps in case of node
@@ -77,7 +77,7 @@ gegl_have_visitor_visit_node (GeglVisitor *self,
              "For \"%s\" have_rect = %d,%d %d×%d",
              gegl_node_get_debug_name (node),
              node->have_rect.x, node->have_rect.y, node->have_rect.width, node->have_rect.height);
-  g_mutex_unlock (node->mutex);
+  g_mutex_unlock (&node->mutex);
 
   time = gegl_ticks () - time;
   gegl_instrument ("process", gegl_node_get_operation (node), time);
diff --git a/gegl/process/gegl-prepare-visitor.c b/gegl/process/gegl-prepare-visitor.c
index af48e91..e2f2aec 100644
--- a/gegl/process/gegl-prepare-visitor.c
+++ b/gegl/process/gegl-prepare-visitor.c
@@ -80,19 +80,19 @@ gegl_prepare_visitor_visit_node (GeglVisitor *self,
         g_assert (graph);
         if (GEGL_NODE (graph)->operation)
           {
-            g_mutex_lock (GEGL_NODE (graph)->mutex);
+            g_mutex_lock (&GEGL_NODE (graph)->mutex);
             /* issuing a prepare on the graph, FIXME: we might need to do
              * a cycle of prepares as deep as the nesting of graphs,.
              * (or find a better way to do this) */
             gegl_operation_prepare (GEGL_NODE (graph)->operation);
-            g_mutex_unlock (GEGL_NODE (graph)->mutex);
+            g_mutex_unlock (&GEGL_NODE (graph)->mutex);
           }
       }
   }
 
-  g_mutex_lock (node->mutex);
+  g_mutex_lock (&node->mutex);
   gegl_operation_prepare (operation);
-  g_mutex_unlock (node->mutex);
+  g_mutex_unlock (&node->mutex);
   {
     /* initialise the "needed rectangle" to an empty one */
     GeglRectangle empty ={0,};


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