mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
std: add alertable argument for windows.WaitForSingleObject
This commit is contained in:
parent
8ecd6c4d8c
commit
21ca54f560
@ -235,7 +235,7 @@ pub const ChildProcess = struct {
|
||||
}
|
||||
|
||||
fn waitUnwrappedWindows(self: *ChildProcess) !void {
|
||||
const result = windows.WaitForSingleObject(self.handle, windows.INFINITE);
|
||||
const result = windows.WaitForSingleObjectEx(self.handle, windows.INFINITE, false);
|
||||
|
||||
self.term = @as(SpawnError!Term, x: {
|
||||
var exit_code: windows.DWORD = undefined;
|
||||
|
||||
@ -171,8 +171,8 @@ pub const WaitForSingleObjectError = error{
|
||||
Unexpected,
|
||||
};
|
||||
|
||||
pub fn WaitForSingleObject(handle: HANDLE, milliseconds: DWORD) WaitForSingleObjectError!void {
|
||||
switch (kernel32.WaitForSingleObject(handle, milliseconds)) {
|
||||
pub fn WaitForSingleObjectEx(handle: HANDLE, milliseconds: DWORD, alertable: bool) WaitForSingleObjectError!void {
|
||||
switch (kernel32.WaitForSingleObjectEx(handle, milliseconds, @boolToInt(alertable))) {
|
||||
WAIT_ABANDONED => return error.WaitAbandoned,
|
||||
WAIT_OBJECT_0 => return,
|
||||
WAIT_TIMEOUT => return error.WaitTimeOut,
|
||||
|
||||
@ -205,6 +205,8 @@ pub extern "kernel32" stdcallcc fn TlsFree(dwTlsIndex: DWORD) BOOL;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) DWORD;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn WaitForSingleObjectEx(hHandle: HANDLE, dwMilliseconds: DWORD, bAlertable: BOOL) DWORD;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn WriteFile(
|
||||
in_hFile: HANDLE,
|
||||
in_lpBuffer: [*]const u8,
|
||||
|
||||
@ -99,7 +99,7 @@ pub const Thread = struct {
|
||||
os.munmap(self.data.memory);
|
||||
},
|
||||
.windows => {
|
||||
windows.WaitForSingleObject(self.data.handle, windows.INFINITE) catch unreachable;
|
||||
windows.WaitForSingleObjectEx(self.data.handle, windows.INFINITE, false) catch unreachable;
|
||||
windows.CloseHandle(self.data.handle);
|
||||
windows.HeapFree(self.data.heap_handle, 0, self.data.alloc_start);
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user