[simple-scan/gnome-3-4: 16/25] Use new GLib threading API



commit 91db537943813fd467db4d98727121106ba5d04c
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Aug 29 13:48:02 2014 +1200

    Use new GLib threading API

 configure.ac     |    1 +
 src/Makefile.am  |    3 ++-
 src/scanner.vala |    9 ++++++---
 3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ee89cb9..acc2c76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,7 @@ dnl * gnome-icon-theme
 dnl * xdg-utils (for xdg-email)
 
 PKG_CHECK_MODULES(SIMPLE_SCAN, [
+    glib-2.0 >= 2.32
     gtk+-3.0
     gmodule-export-2.0
     gthread-2.0
diff --git a/src/Makefile.am b/src/Makefile.am
index 3fa8558..a7d7b3e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,7 +17,8 @@ simple_scan_VALAFLAGS = \
        --pkg=zlib \
        --pkg=gudev-1.0 \
        --pkg=gio-2.0 \
-       --pkg=gtk+-3.0
+       --pkg=gtk+-3.0 \
+       --target-glib 2.32
 
 if HAVE_COLORD
 simple_scan_VALAFLAGS += -D HAVE_COLORD
diff --git a/src/scanner.vala b/src/scanner.vala
index 4e45918..f501fc5 100644
--- a/src/scanner.vala
+++ b/src/scanner.vala
@@ -207,7 +207,7 @@ public class Scanner
     private static Scanner scanner_object = null;
 
     /* Thread communicating with SANE */
-    private unowned Thread<void*> thread;
+    private Thread<void*> thread;
 
     /* Queue of requests from main thread */
     private AsyncQueue<Request> request_queue;
@@ -1443,7 +1443,7 @@ public class Scanner
     {
         try
         {
-            thread = Thread.create<void*> (scan_thread, true);
+            thread = new Thread<void*>.try ("scan-thread", scan_thread);
         }
         catch (Error e)
         {
@@ -1532,8 +1532,11 @@ public class Scanner
         request_queue.push (new RequestQuit ());
 
         if (thread != null)
+        {
             thread.join ();
-
+            thread = null;
+        }
+        
         Sane.exit ();
         debug ("sane_exit ()");
     }


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