[iagno] computer-player: don't run search on UI thread



commit 8bcb83c8e9bccffff1d9ea19103730bd2f015122
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Sep 18 23:47:55 2014 -0500

    computer-player: don't run search on UI thread
    
    It doesn't matter at the low depths we use, but it'd be better not to
    block the UI for the duration of the search.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736941

 src/computer-player.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index 719c2a4..c864982 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -82,7 +82,13 @@ public class ComputerPlayer : Object
         int y = 0;
 
         timer.start ();
-        run_search (ref x, ref y);
+        new Thread<void *> ("AI thread", () => {
+            run_search (ref x, ref y);
+            move_async.callback ();
+            return null;
+        });
+        yield;
+
         timer.stop ();
 
         if (timer.elapsed () < delay_seconds)


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