[gegl] Fix typo in multi threading guards (s/ENABLE_MP/ENABLE_MT)
- From: Øyvind Kolås <ok src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gegl] Fix typo in multi threading guards (s/ENABLE_MP/ENABLE_MT)
- Date: Fri, 20 Nov 2009 02:44:36 +0000 (UTC)
commit ccf2d24582dd5bc819a2ca81c358cfcada5e8906
Author: �yvind Kolås <pippin gimp org>
Date: Fri Nov 20 02:42:57 2009 +0000
Fix typo in multi threading guards (s/ENABLE_MP/ENABLE_MT)
gegl/buffer/gegl-buffer-iterator.c | 18 ++++++++--------
gegl/buffer/gegl-buffer-linear.c | 4 +-
gegl/buffer/gegl-cache.c | 10 ++++----
gegl/buffer/gegl-tile-handler-cache.c | 34 ++++++++++++++++----------------
gegl/buffer/gegl-tile.c | 14 ++++++------
gegl/buffer/gegl-tile.h | 2 +-
gegl/graph/gegl-node.c | 24 +++++++++++-----------
gegl/graph/gegl-node.h | 2 +-
gegl/graph/gegl-visitor.c | 8 +++++-
gegl/property-types/gegl-path.c | 2 +
tests/test-change-processor-rect.c | 1 +
tests/test-color-op.c | 1 +
tests/test-proxynop-processing.c | 1 +
13 files changed, 65 insertions(+), 56 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-iterator.c b/gegl/buffer/gegl-buffer-iterator.c
index d429e88..619c0a6 100644
--- a/gegl/buffer/gegl-buffer-iterator.c
+++ b/gegl/buffer/gegl-buffer-iterator.c
@@ -312,14 +312,14 @@ typedef struct BufInfo {
static GArray *buf_pool = NULL;
-#if ENABLE_MP
+#if ENABLE_MT
static GStaticMutex pool_mutex = G_STATIC_MUTEX_INIT;
#endif
static gpointer iterator_buf_pool_get (gint size)
{
gint i;
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_lock (&pool_mutex);
#endif
@@ -333,7 +333,7 @@ static gpointer iterator_buf_pool_get (gint size)
if (info->size >= size && info->used == 0)
{
info->used ++;
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_unlock (&pool_mutex);
return info->buf;
#endif
@@ -344,7 +344,7 @@ static gpointer iterator_buf_pool_get (gint size)
info.size = size;
info.buf = gegl_malloc (size);
g_array_append_val (buf_pool, info);
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_unlock (&pool_mutex);
#endif
return info.buf;
@@ -354,7 +354,7 @@ static gpointer iterator_buf_pool_get (gint size)
static void iterator_buf_pool_release (gpointer buf)
{
gint i;
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_lock (&pool_mutex);
#endif
for (i=0; i<buf_pool->len; i++)
@@ -363,14 +363,14 @@ static void iterator_buf_pool_release (gpointer buf)
if (info->buf == buf)
{
info->used --;
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_unlock (&pool_mutex);
#endif
return;
}
}
g_assert (0);
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_unlock (&pool_mutex);
#endif
}
@@ -392,7 +392,7 @@ gboolean gegl_buffer_iterator_next (GeglBufferIterator *iterator)
g_error ("%s called on finished buffer iterator", G_STRFUNC);
if (i->iteration_no == 0)
{
-#if ENABLE_MP
+#if ENABLE_MT
for (no=0; no<i->iterators;no++)
{
gint j;
@@ -513,7 +513,7 @@ gboolean gegl_buffer_iterator_next (GeglBufferIterator *iterator)
if (result == FALSE)
{
-#if ENABLE_MP
+#if ENABLE_MT
for (no=0; no<i->iterators;no++)
{
gint j;
diff --git a/gegl/buffer/gegl-buffer-linear.c b/gegl/buffer/gegl-buffer-linear.c
index f7c1ded..cf28831 100644
--- a/gegl/buffer/gegl-buffer-linear.c
+++ b/gegl/buffer/gegl-buffer-linear.c
@@ -133,7 +133,7 @@ gegl_buffer_linear_open (GeglBuffer *buffer,
extent=&buffer->extent;
/*gegl_buffer_lock (buffer);*/
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_lock (buffer->tile_storage->mutex);
#endif
if (extent->x == buffer->extent.x &&
@@ -262,7 +262,7 @@ gegl_buffer_linear_close (GeglBuffer *buffer,
g_object_set_data (G_OBJECT (buffer), "linear-buffers", linear_buffers);
}
/*gegl_buffer_unlock (buffer);*/
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_unlock (buffer->tile_storage->mutex);
#endif
return;
diff --git a/gegl/buffer/gegl-cache.c b/gegl/buffer/gegl-cache.c
index 8691051..356330a 100644
--- a/gegl/buffer/gegl-cache.c
+++ b/gegl/buffer/gegl-cache.c
@@ -33,7 +33,7 @@
#include "gegl-cache.h"
#include "gegl-region.h"
-#if ENABLE_MP
+#if ENABLE_MT
static GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT;
#endif
@@ -370,7 +370,7 @@ void
gegl_cache_invalidate (GeglCache *self,
const GeglRectangle *roi)
{
-#if ENABLE_MP
+#if ENABLE_MT
g_static_rec_mutex_lock (&mutex);
#endif
#if 0
@@ -405,7 +405,7 @@ gegl_cache_invalidate (GeglCache *self,
g_signal_emit (self, gegl_cache_signals[INVALIDATED], 0,
&rect, NULL);
}
-#if ENABLE_MP
+#if ENABLE_MT
g_static_rec_mutex_unlock (&mutex);
#endif
}
@@ -417,12 +417,12 @@ gegl_cache_computed (GeglCache *self,
g_return_if_fail (GEGL_IS_CACHE (self));
g_return_if_fail (rect != NULL);
-#if ENABLE_MP
+#if ENABLE_MT
g_static_rec_mutex_lock (&mutex);
#endif
gegl_region_union_with_rect (self->valid_region, rect);
g_signal_emit (self, gegl_cache_signals[COMPUTED], 0, rect, NULL);
-#if ENABLE_MP
+#if ENABLE_MT
g_static_rec_mutex_unlock (&mutex);
#endif
}
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index 5910f08..c494f25 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -30,7 +30,7 @@
#include "gegl-tile-handler-cache.h"
#include "gegl-debug.h"
-#if ENABLE_MP
+#if ENABLE_MT
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
#endif
@@ -181,7 +181,7 @@ dispose (GObject *object)
CacheItem *item;
GSList *iter;
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_lock (&mutex);
#endif
cache = GEGL_TILE_HANDLER_CACHE (object);
@@ -204,7 +204,7 @@ dispose (GObject *object)
}
g_slist_free (cache->free_list);
cache->free_list = NULL;
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
@@ -373,7 +373,7 @@ gegl_tile_handler_cache_get_tile (GeglTileHandlerCache *cache,
pin.z = z;
pin.handler = cache;
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_lock (&mutex);
#endif
result = g_hash_table_lookup (cache_ht, &pin);
@@ -381,12 +381,12 @@ gegl_tile_handler_cache_get_tile (GeglTileHandlerCache *cache,
{
g_queue_remove (cache_queue, result);
g_queue_push_head (cache_queue, result);
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
return g_object_ref (result->tile);
}
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
return NULL;
@@ -414,7 +414,7 @@ gegl_tile_handler_cache_trim (GeglTileHandlerCache *cache)
{
CacheItem *last_writable;
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_lock (&mutex);
#endif
last_writable = g_queue_pop_tail (cache_queue);
@@ -425,12 +425,12 @@ gegl_tile_handler_cache_trim (GeglTileHandlerCache *cache)
cache_total -= last_writable->tile->size;
g_object_unref (last_writable->tile);
g_slice_free (CacheItem, last_writable);
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
return TRUE;
}
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
@@ -445,7 +445,7 @@ gegl_tile_handler_cache_invalidate (GeglTileHandlerCache *cache,
{
GList *link;
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_lock (&mutex);
#endif
for (link = g_queue_peek_head_link (cache_queue); link; link = link->next)
@@ -466,13 +466,13 @@ gegl_tile_handler_cache_invalidate (GeglTileHandlerCache *cache,
g_hash_table_remove (cache_ht, item);
g_slice_free (CacheItem, item);
g_queue_delete_link (cache_queue, link);
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
return;
}
}
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
}
@@ -489,7 +489,7 @@ gegl_tile_handler_cache_void (GeglTileHandlerCache *cache,
if (!cache_queue)
return;
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_lock (&mutex);
#endif
for (link = g_queue_peek_head_link (cache_queue); link; link = link->next)
@@ -509,13 +509,13 @@ gegl_tile_handler_cache_void (GeglTileHandlerCache *cache,
g_hash_table_remove (cache_ht, item);
g_slice_free (CacheItem, item);
g_queue_delete_link (cache_queue, link);
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
return;
}
}
-#ifdef ENABLE_MP
+#ifdef ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
}
@@ -536,7 +536,7 @@ gegl_tile_handler_cache_insert (GeglTileHandlerCache *cache,
item->y = y;
item->z = z;
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_lock (&mutex);
#endif
cache_total += item->tile->size;
@@ -551,7 +551,7 @@ gegl_tile_handler_cache_insert (GeglTileHandlerCache *cache,
GEGL_NOTE(GEGL_DEBUG_CACHE, "%f%% hit:%i miss:%i %i]", cache_hits*100.0/(cache_hits+cache_misses), cache_hits, cache_misses, g_queue_get_length (cache_queue));*/
gegl_tile_handler_cache_trim (cache);
}
-#if ENABLE_MP
+#if ENABLE_MT
g_static_mutex_unlock (&mutex);
#endif
}
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 39b45d7..f642306 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -139,8 +139,8 @@ dispose (GObject *object)
}
}
-//#define ENABLE_MP 1
-#if ENABLE_MP
+//#define ENABLE_MT 1
+#if ENABLE_MT
if (tile->mutex)
{
g_mutex_free (tile->mutex);
@@ -194,7 +194,7 @@ gegl_tile_init (GeglTile *tile)
tile->next_shared = tile;
tile->prev_shared = tile;
-#if ENABLE_MP
+#if ENABLE_MT
tile->mutex = g_mutex_new ();
#endif
tile->destroy_notify = default_free;
@@ -214,14 +214,14 @@ gegl_tile_dup (GeglTile *src)
tile->next_shared = src->next_shared;
src->next_shared = tile;
tile->prev_shared = src;
-#if ENABLE_MP
+#if ENABLE_MT
if (tile->next_shared != src)
{
g_mutex_lock (tile->next_shared->mutex);
}
#endif
tile->next_shared->prev_shared = tile;
-#if ENABLE_MP
+#if ENABLE_MT
if (tile->next_shared != src)
{
g_mutex_unlock (tile->next_shared->mutex);
@@ -277,7 +277,7 @@ void gegl_bt (void);
void
gegl_tile_lock (GeglTile *tile)
{
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_lock (tile->mutex);
#endif
@@ -342,7 +342,7 @@ gegl_tile_unlock (GeglTile *tile)
}
if (tile->lock==0)
tile->rev++;
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_unlock (tile->mutex);
#endif
}
diff --git a/gegl/buffer/gegl-tile.h b/gegl/buffer/gegl-tile.h
index 07ba5c2..70725cc 100644
--- a/gegl/buffer/gegl-tile.h
+++ b/gegl/buffer/gegl-tile.h
@@ -56,7 +56,7 @@ struct _GeglTile
gchar lock; /* number of times the tile is write locked
* should in theory just have the values 0/1
*/
-#if ENABLE_MP
+#if ENABLE_MT
GMutex *mutex;
#endif
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index aee71af..d0f9df8 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -198,7 +198,7 @@ gegl_node_init (GeglNode *self)
self->operation = NULL;
self->is_graph = FALSE;
self->cache = NULL;
-#if ENABLE_MP
+#if ENABLE_MT
self->mutex = g_mutex_new ();
#endif
@@ -280,7 +280,7 @@ gegl_node_finalize (GObject *gobject)
g_free (self->priv->name);
}
g_hash_table_destroy (self->priv->contexts);
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_free (self->mutex);
#endif
@@ -860,7 +860,7 @@ gegl_node_apply_roi (GeglNode *self,
}
-#if ENABLE_MP
+#if ENABLE_MT
typedef struct ThreadData
{
GeglNode *node;
@@ -921,7 +921,7 @@ gegl_node_blit (GeglNode *self,
g_return_if_fail (roi != NULL);
threads = 2; /* tunable here for now, should be picked up through GeglConfig */
-#if ENABLE_MP
+#if ENABLE_MT
if (pool == NULL)
{
pool = g_thread_pool_new (spawnrender, NULL, threads, TRUE, NULL);
@@ -1777,7 +1777,7 @@ gegl_node_get_context (GeglNode *self,
gpointer context_id)
{
GeglOperationContext *context = NULL;
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_lock (self->mutex);
#endif
@@ -1785,7 +1785,7 @@ gegl_node_get_context (GeglNode *self,
g_return_val_if_fail (context_id != NULL, NULL);
context = g_hash_table_lookup (self->priv->contexts, context_id);
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_unlock (self->mutex);
#endif
return context;
@@ -1801,21 +1801,21 @@ gegl_node_remove_context (GeglNode *self,
g_return_if_fail (context_id != NULL);
context = gegl_node_get_context (self, context_id);
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_lock (self->mutex);
#endif
if (!context)
{
g_warning ("didn't find context %p for %s",
context_id, gegl_node_get_debug_name (self));
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_unlock (self->mutex);
#endif
return;
}
g_hash_table_remove (self->priv->contexts, context_id);
gegl_operation_context_destroy (context);
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_unlock (self->mutex);
#endif
}
@@ -1832,7 +1832,7 @@ 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);
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_lock (self->mutex);
#endif
context = g_hash_table_lookup (self->priv->contexts, context_id);
@@ -1841,7 +1841,7 @@ gegl_node_add_context (GeglNode *self,
{
/* silently ignore, since multiple traversals of prepare are done
* to saturate the graph */
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_unlock (self->mutex);
#endif
return context;
@@ -1850,7 +1850,7 @@ gegl_node_add_context (GeglNode *self,
context = gegl_operation_context_new ();
context->operation = self->operation;
g_hash_table_insert (self->priv->contexts, context_id, context);
-#if ENABLE_MP
+#if ENABLE_MT
g_mutex_unlock (self->mutex);
#endif
return context;
diff --git a/gegl/graph/gegl-node.h b/gegl/graph/gegl-node.h
index 97c810b..edde536 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;
-#if ENABLE_MP
+#if ENABLE_MT
GMutex *mutex;
#endif
diff --git a/gegl/graph/gegl-visitor.c b/gegl/graph/gegl-visitor.c
index 9e109a3..9dd6f2e 100644
--- a/gegl/graph/gegl-visitor.c
+++ b/gegl/graph/gegl-visitor.c
@@ -537,11 +537,15 @@ static void
visit_node (GeglVisitor *self,
GeglNode *node)
{
-#if ENABLE_MP
+#if 0
+#if ENABLE_MT
g_mutex_lock (node->mutex);
#endif
+#endif
self->visits_list = g_slist_prepend (self->visits_list, node);
-#if ENABLE_MP
+#if 0
+#if ENABLE_MT
g_mutex_unlock (node->mutex);
#endif
+#endif
}
diff --git a/gegl/property-types/gegl-path.c b/gegl/property-types/gegl-path.c
index 3896f38..88c8a9a 100644
--- a/gegl/property-types/gegl-path.c
+++ b/gegl/property-types/gegl-path.c
@@ -1892,8 +1892,10 @@ fill_close: /* label used for goto to close last segment */
col[2] *= factor;
col[3] *= factor;
+#if 0
if (gegl_buffer_is_shared (buffer))
while (!gegl_buffer_try_lock (buffer));
+#endif
for (i=0; i < extent.height * versub; i++)
{
diff --git a/tests/test-change-processor-rect.c b/tests/test-change-processor-rect.c
index bb090cb..3769362 100644
--- a/tests/test-change-processor-rect.c
+++ b/tests/test-change-processor-rect.c
@@ -85,6 +85,7 @@ int main(int argc, char *argv[])
g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL);
*/
+ g_thread_init (NULL);
gegl_init (&argc, &argv);
common_color = gegl_color_new ("rgb(1.0, 1.0, 1.0)");
diff --git a/tests/test-color-op.c b/tests/test-color-op.c
index 540f022..403d626 100644
--- a/tests/test-color-op.c
+++ b/tests/test-color-op.c
@@ -44,6 +44,7 @@ int main(int argc, char *argv[])
{ G_MAXINT / 2 - 1, G_MAXINT / 2 - 1, 1, 1 } };
/* Init */
+ g_thread_init (NULL);
gegl_init (&argc, &argv);
colors[0] = gegl_color_new ("rgb(1.0, 0.0, 0.0)");
colors[1] = gegl_color_new ("rgb(0.0, 1.0, 0.0)");
diff --git a/tests/test-proxynop-processing.c b/tests/test-proxynop-processing.c
index 9b420a5..8108ead 100644
--- a/tests/test-proxynop-processing.c
+++ b/tests/test-proxynop-processing.c
@@ -41,6 +41,7 @@ int main(int argc, char *argv[])
GeglColor *color2 = NULL;
/* Init */
+ g_thread_init (NULL);
gegl_init (&argc, &argv);
color1 = gegl_color_new ("rgb(1.0, 0.0, 1.0)");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]