mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Fix bugs with recent change
This change makes further effort towards improving our poll() implementation on the New Technology. The stdin worker didn't work out so well for Python so it's not being used for now. System call tracing with the --strace flag should now be less noisy now on Windows unless you modify the strace.internal.h defines to turn on some optional ones that are most useful for debugging the system call wrappers.
This commit is contained in:
parent
933411ba99
commit
dc0ea6640e
127 changed files with 1354 additions and 866 deletions
|
@ -29,14 +29,6 @@ textwindows int sys_close_nt(struct Fd *fd) {
|
|||
int e;
|
||||
bool ok = true;
|
||||
|
||||
// if this file descriptor is wrapped in a named pipe worker thread
|
||||
// then we need to close our copy of the worker thread handle. it's
|
||||
// also required that whatever install a worker use malloc, so free
|
||||
if (fd->worker) {
|
||||
if (!weaken(UnrefNtStdinWorker)(fd->worker)) ok = false;
|
||||
fd->worker = 0;
|
||||
}
|
||||
|
||||
if (fd->kind == kFdFile && ((fd->flags & O_ACCMODE) != O_RDONLY &&
|
||||
GetFileType(fd->handle) == kNtFileTypeDisk)) {
|
||||
// Like Linux, closing a file on Windows doesn't guarantee it's
|
||||
|
@ -47,8 +39,15 @@ textwindows int sys_close_nt(struct Fd *fd) {
|
|||
errno = e;
|
||||
}
|
||||
|
||||
// now we can close the handle
|
||||
if (!CloseHandle(fd->handle)) ok = false;
|
||||
// if this file descriptor is wrapped in a named pipe worker thread
|
||||
// then we need to close our copy of the worker thread handle. it's
|
||||
// also required that whatever install a worker use malloc, so free
|
||||
if (fd->worker) {
|
||||
if (!weaken(UnrefNtStdinWorker)(fd->worker)) ok = false;
|
||||
fd->worker = 0;
|
||||
} else {
|
||||
if (!CloseHandle(fd->handle)) ok = false;
|
||||
}
|
||||
if (fd->kind == kFdConsole && fd->extra && fd->extra != -1) {
|
||||
if (!CloseHandle(fd->extra)) ok = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue