Skip to content

Commit 57440a7

Browse files
committed
Global (Windows): makes NtWaitForSingleObject not alertable
1 parent f50059d commit 57440a7

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/common/impl/io_windows.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ const char* ffGetTerminalResponse(const char* request, int nParams, const char*
419419

420420
while (true)
421421
{
422-
if (NtWaitForSingleObject(hInput, TRUE, &(LARGE_INTEGER) { .QuadPart = (int64_t) FF_IO_TERM_RESP_WAIT_MS * -10000 }) != STATUS_WAIT_0)
422+
if (NtWaitForSingleObject(hInput, FALSE, &(LARGE_INTEGER) { .QuadPart = (int64_t) FF_IO_TERM_RESP_WAIT_MS * -10000 }) != STATUS_WAIT_0)
423423
{
424424
SetConsoleMode(hInput, inputMode);
425425
return "NtWaitForSingleObject() failed or timeout";

src/common/impl/processing_windows.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static void terminateChildProcess(HANDLE hProcess, HANDLE hChildPipeRead, HANDLE
146146
if (NT_SUCCESS(NtCancelIoFileEx(hChildPipeRead, piosb, &cancelIosb)))
147147
{
148148
if (hReadEvent)
149-
NtWaitForSingleObject(hReadEvent, TRUE, &(LARGE_INTEGER) { .QuadPart = -100000 }); // wait for cancellation to complete
149+
NtWaitForSingleObject(hReadEvent, FALSE, &(LARGE_INTEGER) { .QuadPart = -100000 }); // wait for cancellation to complete
150150
}
151151
NtTerminateProcess(hProcess, 1);
152152
}
@@ -184,7 +184,7 @@ const char* ffProcessReadOutput(FFProcessHandle* handle, FFstrbuf* buffer)
184184
);
185185
if (status == STATUS_PENDING)
186186
{
187-
switch (NtWaitForSingleObject(hReadEvent, TRUE, &(LARGE_INTEGER) { .QuadPart = (int64_t) timeout * -10000 }))
187+
switch (NtWaitForSingleObject(hReadEvent, FALSE, &(LARGE_INTEGER) { .QuadPart = (int64_t) timeout * -10000 }))
188188
{
189189
case STATUS_WAIT_0:
190190
status = iosb.Status;

src/common/thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
static inline void ffThreadDetach(FFThreadType thread) { NtClose(thread); }
2222
static inline bool ffThreadJoin(FFThreadType thread, uint32_t timeout)
2323
{
24-
if (NtWaitForSingleObject(thread, TRUE, timeout == 0 ? NULL : &(LARGE_INTEGER) { .QuadPart = (int64_t) timeout * -10000 }) != STATUS_WAIT_0)
24+
if (NtWaitForSingleObject(thread, FALSE, timeout == 0 ? NULL : &(LARGE_INTEGER) { .QuadPart = (int64_t) timeout * -10000 }) != STATUS_WAIT_0)
2525
{
2626
TerminateThread(thread, (DWORD) -1);
2727
NtClose(thread);

0 commit comments

Comments
 (0)