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/Makefile b/Makefile
index c795ea4..a127027 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
UNAME := $(shell uname)
GTKCFLAGS = `pkg-config gtk+-2.0 --cflags`
-GTKLDFLAGS = `pkg-config gtk+-2.0 --libs`
+GTKLDFLAGS = `pkg-config gtk+-2.0 gthread-2.0 --libs`
SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \
eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
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;
}