1632
1633
1634
1635
1636
1637
1638
1639 pub fn cancel(s: *S) ?U {
const io = s.io;
s.group.cancel(io);
s.queue.close(io);
return s.queue.getOneUncancelable(io) catch |err| switch (err) {
error.Closed => return null,
};
}
Requests cancelation on all remaining tasks owned by the select, then blocks until they all finish. If the select was initialized with insufficient buffer space for all remaining tasks to finish, a deadlock occurs.
If any of the select tasks allocate resources, those tasks may have completed, meaning that this function must be called in a loop until
nullis returned in order to deallocate those resources. If there is no possibility of resource leaks,cancelDiscardis preferable.It is illegal to call
awaitorawaitManyafter this.It is safe to call this multiple times, even after
nullis returned.Threadsafe.