From 2839f0c6d86e99313e1a039293b36aa570db3ace Mon Sep 17 00:00:00 2001 From: "Stephen M. Cameron" Date: Fri, 24 Feb 2012 08:17:31 +0100 Subject: [PATCH] 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 Signed-off-by: Jens Axboe --- Makefile | 2 +- gfio.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c795ea48..a1270276 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ SCRIPTS = fio_generate_plots 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 f41a7ba7..2d97caca 100644 --- a/gfio.c +++ b/gfio.c @@ -168,6 +168,14 @@ static void add_buttons(struct gui *ui, 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 @@ int main(int argc, char *argv[], char *envp[]) init_ui(&argc, &argv, &ui); + gdk_threads_enter(); gtk_main(); + gdk_threads_leave(); return 0; } -- 2.25.1