diff options
author | Ron Yorston <rmy@pobox.com> | 2023-07-01 11:48:50 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-01 11:48:50 +0000 |
commit | ab4d47f334c53035a04bde0fcde5d21a5b6d0913 (patch) | |
tree | fa37c4662da564ceca479584cff657546e285c9f | |
parent | 795dae827273f5b7e77a65653b40c98b89567ba7 (diff) | |
parent | 3714121907480869bb7e77ebce5810affbdb8bea (diff) | |
download | busybox-w32-ab4d47f334c53035a04bde0fcde5d21a5b6d0913.tar.gz busybox-w32-ab4d47f334c53035a04bde0fcde5d21a5b6d0913.tar.bz2 busybox-w32-ab4d47f334c53035a04bde0fcde5d21a5b6d0913.zip |
Merge pull request #338 from avih/concp
win32: UTF8 console input: don't spin the CPU
-rw-r--r-- | win32/winansi.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index d85b6de23..67fcc17d3 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -1314,9 +1314,11 @@ BOOL readConsoleInput_utf8(HANDLE h, INPUT_RECORD *r, DWORD len, DWORD *got) | |||
1314 | if (u8pos == u8len) { | 1314 | if (u8pos == u8len) { |
1315 | DWORD codepoint; | 1315 | DWORD codepoint; |
1316 | 1316 | ||
1317 | // peek rather than read to keep the last processed record at | 1317 | // wait-and-peek rather than read to keep the last processed record |
1318 | // the console queue until we deliver all of its products, so | 1318 | // at the console queue until we deliver all of its products, so |
1319 | // that WaitForSingleObject(handle) shows there's data ready. | 1319 | // that external WaitForSingleObject(h) shows there's data ready. |
1320 | if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) | ||
1321 | return FALSE; | ||
1320 | if (!PeekConsoleInputW(h, r, 1, got)) | 1322 | if (!PeekConsoleInputW(h, r, 1, got)) |
1321 | return FALSE; | 1323 | return FALSE; |
1322 | if (*got == 0) | 1324 | if (*got == 0) |