| ... | @@ -993,7 +993,7 @@ pub fn Future(Result: type) type { | ... | @@ -993,7 +993,7 @@ pub fn Future(Result: type) type { |
| 993 | /// Idempotent. Not threadsafe. | 993 | /// Idempotent. Not threadsafe. |
| 994 | pub fn cancel(f: *@This(), io: Io) Result { | 994 | pub fn cancel(f: *@This(), io: Io) Result { |
| 995 | const any_future = f.any_future orelse return f.result; | 995 | const any_future = f.any_future orelse return f.result; |
| 996 | io.vtable.cancel(io.userdata, any_future, @ptrCast((&f.result)[0..1]), .of(Result)); | 996 | io.vtable.cancel(io.userdata, any_future, @ptrCast(&f.result), .of(Result)); |
| 997 | f.any_future = null; | 997 | f.any_future = null; |
| 998 | return f.result; | 998 | return f.result; |
| 999 | } | 999 | } |
| ... | @@ -1001,7 +1001,7 @@ pub fn Future(Result: type) type { | ... | @@ -1001,7 +1001,7 @@ pub fn Future(Result: type) type { |
| 1001 | /// Idempotent. Not threadsafe. | 1001 | /// Idempotent. Not threadsafe. |
| 1002 | pub fn await(f: *@This(), io: Io) Result { | 1002 | pub fn await(f: *@This(), io: Io) Result { |
| 1003 | const any_future = f.any_future orelse return f.result; | 1003 | const any_future = f.any_future orelse return f.result; |
| 1004 | io.vtable.await(io.userdata, any_future, @ptrCast((&f.result)[0..1]), .of(Result)); | 1004 | io.vtable.await(io.userdata, any_future, @ptrCast(&f.result), .of(Result)); |
| 1005 | f.any_future = null; | 1005 | f.any_future = null; |
| 1006 | return f.result; | 1006 | return f.result; |
| 1007 | } | 1007 | } |
| ... | @@ -1037,7 +1037,7 @@ pub const Group = struct { | ... | @@ -1037,7 +1037,7 @@ pub const Group = struct { |
| 1037 | @call(.auto, function, args_casted.*); | 1037 | @call(.auto, function, args_casted.*); |
| 1038 | } | 1038 | } |
| 1039 | }; | 1039 | }; |
| 1040 | io.vtable.groupAsync(io.userdata, g, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start); | 1040 | io.vtable.groupAsync(io.userdata, g, @ptrCast(&args), .of(Args), TypeErased.start); |
| 1041 | } | 1041 | } |
| 1042 | | 1042 | |
| 1043 | /// Blocks until all tasks of the group finish. During this time, | 1043 | /// Blocks until all tasks of the group finish. During this time, |
| ... | @@ -1114,7 +1114,7 @@ pub fn Select(comptime U: type) type { | ... | @@ -1114,7 +1114,7 @@ pub fn Select(comptime U: type) type { |
| 1114 | } | 1114 | } |
| 1115 | }; | 1115 | }; |
| 1116 | _ = @atomicRmw(usize, &s.outstanding, .Add, 1, .monotonic); | 1116 | _ = @atomicRmw(usize, &s.outstanding, .Add, 1, .monotonic); |
| 1117 | s.io.vtable.groupAsync(s.io.userdata, &s.group, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start); | 1117 | s.io.vtable.groupAsync(s.io.userdata, &s.group, @ptrCast(&args), .of(Args), TypeErased.start); |
| 1118 | } | 1118 | } |
| 1119 | | 1119 | |
| 1120 | /// Blocks until another task of the select finishes. | 1120 | /// Blocks until another task of the select finishes. |
| ... | @@ -1542,9 +1542,9 @@ pub fn async( | ... | @@ -1542,9 +1542,9 @@ pub fn async( |
| 1542 | var future: Future(Result) = undefined; | 1542 | var future: Future(Result) = undefined; |
| 1543 | future.any_future = io.vtable.async( | 1543 | future.any_future = io.vtable.async( |
| 1544 | io.userdata, | 1544 | io.userdata, |
| 1545 | @ptrCast((&future.result)[0..1]), | 1545 | @ptrCast(&future.result), |
| 1546 | .of(Result), | 1546 | .of(Result), |
| 1547 | @ptrCast((&args)[0..1]), | 1547 | @ptrCast(&args), |
| 1548 | .of(Args), | 1548 | .of(Args), |
| 1549 | TypeErased.start, | 1549 | TypeErased.start, |
| 1550 | ); | 1550 | ); |
| ... | @@ -1583,7 +1583,7 @@ pub fn concurrent( | ... | @@ -1583,7 +1583,7 @@ pub fn concurrent( |
| 1583 | io.userdata, | 1583 | io.userdata, |
| 1584 | @sizeOf(Result), | 1584 | @sizeOf(Result), |
| 1585 | .of(Result), | 1585 | .of(Result), |
| 1586 | @ptrCast((&args)[0..1]), | 1586 | @ptrCast(&args), |
| 1587 | .of(Args), | 1587 | .of(Args), |
| 1588 | TypeErased.start, | 1588 | TypeErased.start, |
| 1589 | ); | 1589 | ); |