Clone in a terminal:
Commit 9baa516
Johan Mattsson - 2015-10-06T18:42:08+00:00
9baa51602b05bc58b5e7d1d9e88afab4c65b5a0bjohan.mattsson.m@gmail.com

Handle debug messages from background threads

Changed files (2)

Diff

diff --git a/libbirdfont/BirdFont.vala b/libbirdfont/BirdFont.valaindex 3323e11..bcb73ed 100644--- a/libbirdfont/BirdFont.vala+++ b/libbirdfont/BirdFont.vala@@ -365,7 +365,7 @@ public class BirdFont { 	public static string exec_path = ""; 	public static string? bundle_path = null; -	public static bool logging = false;+	internal static bool logging = false; 	public static DataOutputStream? logstream = null;  	public static Font current_font;@@ -683,7 +683,25 @@ public class BirdFont { 	 	internal static string? get_argument (string param) { 		return args.get_argument (param);-	}	+	}+	+	public static void debug_message (string s) {+		lock (BirdFont.logging) {+			if (unlikely (BirdFont.logging)) {+				try {+					if (BirdFont.logstream != null) {+						((!)BirdFont.logstream).put_string (s);+					} else {+						warning ("No logstream.");+					}+					+					stderr.printf (s);+				} catch (GLib.Error e) {+					warning (e.message);+				}+			}+		}+	} }  void init_logfile () {@@ -732,27 +750,7 @@ public static void printd (string s) { #if ANDROID 	__android_log_print (ANDROID_LOG_WARN, "BirdFont", s); #else-	IdleSource idle = new IdleSource ();--	idle.set_callback (() => {-		if (unlikely (BirdFont.logging)) {-			try {-				if (BirdFont.logstream != null) {-					((!)BirdFont.logstream).put_string (s);-				} else {-					warning ("No logstream.");-				}-				-				stderr.printf (s);-			} catch (GLib.Error e) {-				warning (e.message);-			}-		}-		-		return false;-	});-	-	idle.attach (null);+	BirdFont.debug_message (s); #endif } diff --git a/libbirdgems/GGVecLib.c b/libbirdgems/GGVecLib.cindex 4f1e7cd..55393a8 100644--- a/libbirdgems/GGVecLib.c+++ b/libbirdgems/GGVecLib.c@@ -379,7 +379,7 @@ int i, j, k;  /* binary greatest common divisor by Silver and Terzian.  See Knuth */ /* both inputs must be >= 0 */-gcd(u, v)+int gcd(u, v) int u, v; { int t, f;

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112