fio: make gui status update in timely fashion

Needs inexplicable special gtk/gdk magic code for some reason.
(Learned this by hard won experience on Word War vi.)

Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/gfio.c b/gfio.c
index f41a7ba..2d97cac 100644
--- a/gfio.c
+++ b/gfio.c
@@ -168,6 +168,14 @@
 
 static void init_ui(int *argc, char **argv[], struct gui *ui)
 {
+	/* Magical g*thread incantation, you just need this thread stuff.
+	 * Without it, the label update that happens in gfio_update_thread_status
+	 * doesn't really happen in a timely fashion, you need expose events
+	 */
+	if (!g_thread_supported ())
+		g_thread_init(NULL);
+	gdk_threads_init();
+
 	gtk_init(argc, argv);
 	
 	ui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -196,6 +204,8 @@
 
 	init_ui(&argc, &argv, &ui);
 
+	gdk_threads_enter();
 	gtk_main();
+	gdk_threads_leave();
 	return 0;
 }