From 5c2857f9f5cb350c9441be3f3e1cd7c9dc18b1c5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 4 Oct 2011 13:14:32 +0200 Subject: [PATCH] client: improve poll() loop Signed-off-by: Jens Axboe --- client.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 5f0f710a..b632241a 100644 --- a/client.c +++ b/client.c @@ -31,9 +31,11 @@ struct fio_client { }; enum { + Client_created = 0, Client_connected = 1, Client_started = 2, Client_stopped = 3, + Client_exited = 4, }; static FLIST_HEAD(client_list); @@ -525,14 +527,16 @@ int fio_handle_clients(void) assert(i == nr_clients); - ret = poll(pfds, nr_clients, 100); - if (ret < 0) { - if (errno == EINTR) + do { + ret = poll(pfds, nr_clients, 100); + if (ret < 0) { + if (errno == EINTR) + continue; + log_err("fio: poll clients: %s\n", strerror(errno)); + break; + } else if (!ret) continue; - log_err("fio: poll clients: %s\n", strerror(errno)); - break; - } else if (!ret) - continue; + } while (ret <= 0); for (i = 0; i < nr_clients; i++) { if (!(pfds[i].revents & POLLIN)) -- 2.25.1