mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
std.Io.Threaded: fix bad use of AlertableSyscall
The defer would cause two problems: 1. keeping the state active during call to NtCancelIoFile 2. invalid state transition. after canceled is returned from checkCancel, new status is already canceled. calling finish after that is illegal.
This commit is contained in:
@@ -8689,7 +8689,6 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
|
||||
return e;
|
||||
},
|
||||
};
|
||||
defer alertable_syscall.finish();
|
||||
waitForApcOrAlert();
|
||||
while (@atomicLoad(windows.NTSTATUS, &io_status_block.u.Status, .acquire) == .PENDING) {
|
||||
alertable_syscall.checkCancel() catch |err| switch (err) {
|
||||
@@ -8700,6 +8699,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
|
||||
};
|
||||
waitForApcOrAlert();
|
||||
}
|
||||
alertable_syscall.finish();
|
||||
},
|
||||
} else |err| return err;
|
||||
return ntReadFileResult(&io_status_block);
|
||||
|
||||
Reference in New Issue
Block a user