From 8d3a368d8980e37e7e8c57065dc901ce809887c6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 1 Jun 2016 22:47:29 -0700 Subject: os: InputThreadFillPipe doesn't need select or poll The file descriptors passed to InputThreadFillPipe are always blocking, so there's no need to use Select (or poll). Signed-off-by: Keith Packard Reviewed-by: Adam Jackson --- os/inputthread.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/os/inputthread.c b/os/inputthread.c index 40a044375..a4266e92d 100644 --- a/os/inputthread.c +++ b/os/inputthread.c @@ -127,24 +127,10 @@ InputThreadFillPipe(int writeHead) { int ret; char byte = 0; - fd_set writePipe; - FD_ZERO(&writePipe); - - while (1) { + do { ret = write(writeHead, &byte, 1); - if (!ret) - FatalError("input-thread: write() returned 0"); - if (ret > 0) - break; - - if (errno != EAGAIN) - FatalError("input-thread: filling pipe"); - - DebugF("input-thread: pipe full\n"); - FD_SET(writeHead, &writePipe); - Select(writeHead + 1, NULL, &writePipe, NULL, NULL); - } + } while (ret < 0 && ETEST(errno)); } /** -- cgit v1.2.3