| ... | @@ -1269,10 +1269,13 @@ pub fn Select(comptime U: type) type { | ... | @@ -1269,10 +1269,13 @@ pub fn Select(comptime U: type) type { |
| 1269 | args: @TypeOf(args), | 1269 | args: @TypeOf(args), |
| 1270 | fn start(type_erased_context: *const anyopaque) Cancelable!void { | 1270 | fn start(type_erased_context: *const anyopaque) Cancelable!void { |
| 1271 | const context: *const @This() = @ptrCast(@alignCast(type_erased_context)); | 1271 | const context: *const @This() = @ptrCast(@alignCast(type_erased_context)); |
| 1272 | const elem = @unionInit(U, @tagName(field), @call(.auto, function, context.args)); | 1272 | const raw_result = @call(.auto, function, context.args); |
| | 1273 | const elem = @unionInit(U, @tagName(field), raw_result); |
| 1273 | context.select.queue.putOneUncancelable(context.select.io, elem) catch |err| switch (err) { | 1274 | context.select.queue.putOneUncancelable(context.select.io, elem) catch |err| switch (err) { |
| 1274 | error.Closed => unreachable, | 1275 | error.Closed => unreachable, |
| 1275 | }; | 1276 | }; |
| | 1277 | if (@typeInfo(@TypeOf(raw_result)) == .error_union) |
| | 1278 | raw_result catch |err| if (err == error.Canceled) return error.Canceled; |
| 1276 | } | 1279 | } |
| 1277 | }; | 1280 | }; |
| 1278 | const context: Context = .{ .select = s, .args = args }; | 1281 | const context: Context = .{ .select = s, .args = args }; |