| ... | ... | @@ -1178,7 +1178,6 @@ pub fn Select(comptime U: type) type { |
| 1178 | 1178 | io: Io, |
| 1179 | 1179 | group: Group, |
| 1180 | 1180 | queue: Queue(U), |
| 1181 | | outstanding: usize, |
| 1182 | 1181 | |
| 1183 | 1182 | const S = @This(); |
| 1184 | 1183 | |
| ... | ... | @@ -1191,7 +1190,6 @@ pub fn Select(comptime U: type) type { |
| 1191 | 1190 | .io = io, |
| 1192 | 1191 | .queue = .init(buffer), |
| 1193 | 1192 | .group = .init, |
| 1194 | | .outstanding = 0, |
| 1195 | 1193 | }; |
| 1196 | 1194 | } |
| 1197 | 1195 | |
| ... | ... | @@ -1235,7 +1233,6 @@ pub fn Select(comptime U: type) type { |
| 1235 | 1233 | } |
| 1236 | 1234 | }; |
| 1237 | 1235 | const context: Context = .{ .select = s, .args = args }; |
| 1238 | | _ = @atomicRmw(usize, &s.outstanding, .Add, 1, .monotonic); |
| 1239 | 1236 | s.io.vtable.groupAsync(s.io.userdata, &s.group, @ptrCast(&context), .of(Context), Context.start); |
| 1240 | 1237 | } |
| 1241 | 1238 | |
| ... | ... | @@ -1276,16 +1273,12 @@ pub fn Select(comptime U: type) type { |
| 1276 | 1273 | }; |
| 1277 | 1274 | const context: Context = .{ .select = s, .args = args }; |
| 1278 | 1275 | try s.io.vtable.groupConcurrent(s.io.userdata, &s.group, @ptrCast(&context), .of(Context), Context.start); |
| 1279 | | _ = @atomicRmw(usize, &s.outstanding, .Add, 1, .monotonic); |
| 1280 | 1276 | } |
| 1281 | 1277 | |
| 1282 | 1278 | /// Blocks until another task of the select finishes. |
| 1283 | 1279 | /// |
| 1284 | | /// Asserts there is at least one more `outstanding` task. |
| 1285 | | /// |
| 1286 | 1280 | /// Not threadsafe. |
| 1287 | 1281 | pub fn await(s: *S) Cancelable!U { |
| 1288 | | s.outstanding -= 1; |
| 1289 | 1282 | return s.queue.getOne(s.io) catch |err| switch (err) { |
| 1290 | 1283 | error.Canceled => |e| return e, |
| 1291 | 1284 | error.Closed => unreachable, |
| ... | ... | @@ -1301,7 +1294,6 @@ pub fn Select(comptime U: type) type { |
| 1301 | 1294 | /// |
| 1302 | 1295 | /// Idempotent. Not threadsafe. |
| 1303 | 1296 | pub fn cancel(s: *S) void { |
| 1304 | | s.outstanding = 0; |
| 1305 | 1297 | s.group.cancel(s.io); |
| 1306 | 1298 | } |
| 1307 | 1299 | }; |