| ... | @@ -1446,11 +1446,8 @@ pub fn Select(comptime U: type) type { | ... | @@ -1446,11 +1446,8 @@ pub fn Select(comptime U: type) type { |
| 1446 | /// Threadsafe. | 1446 | /// Threadsafe. |
| 1447 | pub fn cancel(s: *S) ?U { | 1447 | pub fn cancel(s: *S) ?U { |
| 1448 | const io = s.io; | 1448 | const io = s.io; |
| 1449 | if (s.group.token.load(.acquire)) |token| { | 1449 | s.group.cancel(io); |
| 1450 | io.vtable.groupCancel(io.userdata, &s.group, token); | 1450 | s.queue.close(io); |
| 1451 | assert(s.group.token.raw == null); | | |
| 1452 | s.queue.close(io); | | |
| 1453 | } | | |
| 1454 | return s.queue.getOneUncancelable(io) catch |err| switch (err) { | 1451 | return s.queue.getOneUncancelable(io) catch |err| switch (err) { |
| 1455 | error.Closed => return null, | 1452 | error.Closed => return null, |
| 1456 | }; | 1453 | }; |
| ... | @@ -1855,7 +1852,7 @@ pub const TypeErasedQueue = struct { | ... | @@ -1855,7 +1852,7 @@ pub const TypeErasedQueue = struct { |
| 1855 | /// there is space in the buffer. However, existing elements of the | 1852 | /// there is space in the buffer. However, existing elements of the |
| 1856 | /// queue are retrieved before `error.Closed` is returned. | 1853 | /// queue are retrieved before `error.Closed` is returned. |
| 1857 | /// | 1854 | /// |
| 1858 | /// Threadsafe. | 1855 | /// Idempotent. Threadsafe. |
| 1859 | pub fn close(q: *TypeErasedQueue, io: Io) void { | 1856 | pub fn close(q: *TypeErasedQueue, io: Io) void { |
| 1860 | q.mutex.lockUncancelable(io); | 1857 | q.mutex.lockUncancelable(io); |
| 1861 | defer q.mutex.unlock(io); | 1858 | defer q.mutex.unlock(io); |