diff options
author | Keith Packard <keithp@keithp.com> | 2016-06-01 22:47:29 -0700 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-07-18 15:27:51 -0400 |
commit | 8d3a368d8980e37e7e8c57065dc901ce809887c6 (patch) | |
tree | 3a1d0fc6bf24f9c82734f2ea24cd550f5fbedb96 /os/inputthread.c | |
parent | ef7ddbe242ed4c461f816663fb88646e41f1c21b (diff) |
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 <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'os/inputthread.c')
-rw-r--r-- | os/inputthread.c | 18 |
1 files 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)); } /** |