From 30b18672f5318b7f6de70da6fdc9577737e7a6e6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 11 Apr 2014 00:03:32 +0200 Subject: [PATCH] iolog: check for thread termination in long delays If we are doing a long delay now, fio won't be able to kill the thread when you ctrl-c the job. Split the delay into .5s intervals, and check for signal in between. Signed-off-by: Jens Axboe --- iolog.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/iolog.c b/iolog.c index 1eb89b29..f4989592 100644 --- a/iolog.c +++ b/iolog.c @@ -58,6 +58,7 @@ void log_file(struct thread_data *td, struct fio_file *f, static void iolog_delay(struct thread_data *td, unsigned long delay) { unsigned long usec = utime_since_now(&td->last_issue); + unsigned long this_delay; if (delay < usec) return; @@ -70,7 +71,14 @@ static void iolog_delay(struct thread_data *td, unsigned long delay) if (delay < 100) return; - usec_sleep(td, delay); + while (delay && !td->terminate) { + this_delay = delay; + if (this_delay > 500000) + this_delay = 500000; + + usec_sleep(td, this_delay); + delay -= this_delay; + } } static int ipo_special(struct thread_data *td, struct io_piece *ipo) -- 2.25.1