mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-13 06:29:11 +00:00
Make stdin pollable on Windows
You can now play Super Mario Bros in CMD.EXE using Cosmopolitan! This is thanks to a new worker thread that's spawned on Windows whenever any one of poll(), select(), or ioctl(FIONREAD) is linked.
This commit is contained in:
parent
ef6387ee5e
commit
9c0821def7
15 changed files with 280 additions and 58 deletions
|
@ -32,6 +32,8 @@
|
|||
#include "libc/nt/runtime.h"
|
||||
#include "libc/nt/struct/pollfd.h"
|
||||
#include "libc/nt/synchronization.h"
|
||||
#include "libc/nt/thread.h"
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
#include "libc/nt/winsock.h"
|
||||
#include "libc/sock/internal.h"
|
||||
#include "libc/sock/struct/pollfd.h"
|
||||
|
@ -43,6 +45,8 @@
|
|||
|
||||
#ifdef __x86_64__
|
||||
|
||||
__static_yoink("WinMainStdin");
|
||||
|
||||
/*
|
||||
* Polls on the New Technology.
|
||||
*
|
||||
|
@ -92,7 +96,7 @@ textwindows int sys_poll_nt(struct pollfd *fds, uint64_t nfds, uint64_t *ms,
|
|||
}
|
||||
} else if (pn < ARRAYLEN(pipefds)) {
|
||||
pipeindices[pn] = i;
|
||||
pipefds[pn].handle = g_fds.p[fds[i].fd].handle;
|
||||
pipefds[pn].handle = __resolve_stdin_handle(g_fds.p[fds[i].fd].handle);
|
||||
pipefds[pn].events = 0;
|
||||
pipefds[pn].revents = 0;
|
||||
switch (g_fds.p[fds[i].fd].flags & O_ACCMODE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue