mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:44:43 +01:00
Io.Select: do not swallow error.Canceled of task
This commit is contained in:
parent
46fcf22630
commit
376320a5e9
1 changed files with 4 additions and 1 deletions
|
|
@ -1269,10 +1269,13 @@ pub fn Select(comptime U: type) type {
|
|||
args: @TypeOf(args),
|
||||
fn start(type_erased_context: *const anyopaque) Cancelable!void {
|
||||
const context: *const @This() = @ptrCast(@alignCast(type_erased_context));
|
||||
const elem = @unionInit(U, @tagName(field), @call(.auto, function, context.args));
|
||||
const raw_result = @call(.auto, function, context.args);
|
||||
const elem = @unionInit(U, @tagName(field), raw_result);
|
||||
context.select.queue.putOneUncancelable(context.select.io, elem) catch |err| switch (err) {
|
||||
error.Closed => unreachable,
|
||||
};
|
||||
if (@typeInfo(@TypeOf(raw_result)) == .error_union)
|
||||
raw_result catch |err| if (err == error.Canceled) return error.Canceled;
|
||||
}
|
||||
};
|
||||
const context: Context = .{ .select = s, .args = args };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue