[gegl] operation: use atomic spin lock instead of g_usleep



commit 0a0b594d49209a4daa18d9cb9372b76db711183b
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Jun 30 23:42:41 2014 +0200

    operation: use atomic spin lock instead of g_usleep

 gegl/operation/gegl-operation-composer.c  |    3 +--
 gegl/operation/gegl-operation-composer3.c |    3 +--
 gegl/operation/gegl-operation-filter.c    |    3 +--
 gegl/operation/gegl-operation-source.c    |    3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer.c b/gegl/operation/gegl-operation-composer.c
index 321895c..a1a2a5f 100644
--- a/gegl/operation/gegl-operation-composer.c
+++ b/gegl/operation/gegl-operation-composer.c
@@ -209,8 +209,7 @@ gegl_operation_composer_process (GeglOperation        *operation,
           g_thread_pool_push (pool, &thread_data[i], NULL);
         thread_process (&thread_data[0], NULL);
 
-        while (pending != 0)
-          g_usleep (1);
+        while (g_atomic_int_get (&pending)) {};
 
         success = thread_data[0].success;
       }
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index baa0ea0..22c6d49 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -232,8 +232,7 @@ gegl_operation_composer3_process (GeglOperation        *operation,
           g_thread_pool_push (pool, &thread_data[i], NULL);
         thread_process (&thread_data[0], NULL);
 
-        while (pending != 0)
-          g_usleep (1);
+        while (g_atomic_int_get (&pending)) {};
         
         success = thread_data[0].success;
       }
diff --git a/gegl/operation/gegl-operation-filter.c b/gegl/operation/gegl-operation-filter.c
index fb97188..c7e3754 100644
--- a/gegl/operation/gegl-operation-filter.c
+++ b/gegl/operation/gegl-operation-filter.c
@@ -211,8 +211,7 @@ gegl_operation_filter_process (GeglOperation        *operation,
       g_thread_pool_push (pool, &thread_data[i], NULL);
     thread_process (&thread_data[0], NULL);
 
-    while (pending != 0) g_usleep (1);
-
+    while (g_atomic_int_get (&pending)) {};
 
     success = thread_data[0].success;
   }
diff --git a/gegl/operation/gegl-operation-source.c b/gegl/operation/gegl-operation-source.c
index 7246f2e..7be0333 100644
--- a/gegl/operation/gegl-operation-source.c
+++ b/gegl/operation/gegl-operation-source.c
@@ -176,8 +176,7 @@ gegl_operation_source_process (GeglOperation        *operation,
       g_thread_pool_push (pool, &thread_data[i], NULL);
     thread_process (&thread_data[0], NULL);
 
-    while (pending != 0)
-      g_usleep (1);
+    while (g_atomic_int_get (&pending)) {};
 
     success = thread_data[0].success;
   }


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