fio: make gui actually do something
authorStephen M. Cameron <stephenmcameron@gmail.com>
Fri, 24 Feb 2012 07:17:31 +0000 (08:17 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Feb 2012 07:17:31 +0000 (08:17 +0100)
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
gfio.c

diff --git a/gfio.c b/gfio.c
index 6c03ce9ff57c9bcc6f24ceb8e135633f47eed5eb..d736a261aab8705a92a4fd6da2bf13802a62262f 100644 (file)
--- a/gfio.c
+++ b/gfio.c
@@ -51,6 +51,7 @@ struct gui {
        GtkWidget *window;
        GtkWidget *buttonbox;
        GtkWidget *button[ARRAYSIZE(buttonspeclist)];
+       pthread_t t;
 };
 
 static void gfio_text_op(struct fio_client *client,
@@ -105,10 +106,28 @@ static void quit_clicked(__attribute__((unused)) GtkWidget *widget,
         gtk_main_quit();
 }
 
+static void *job_thread(void *arg)
+{
+       struct gui *ui = arg;
+
+       fio_handle_clients(&gfio_client_ops);
+       gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 1);
+       return NULL;
+}
+
+static void start_job_thread(pthread_t *t, struct gui *ui)
+{
+       pthread_create(t, NULL, job_thread, ui);
+}
+
 static void start_job_clicked(__attribute__((unused)) GtkWidget *widget,
-                __attribute__((unused)) gpointer data)
+                gpointer data)
 {
+       struct gui *ui = data;
+
        printf("Start job button was clicked.\n");
+       gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
+       start_job_thread(&ui->t, ui);
 }
 
 static void add_button(struct gui *ui, int i, GtkWidget *buttonbox,