Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

cancel

Public Function
std.Io.Select.cancel
pub fn cancel(s: *S) ?U

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 null is returned in order to deallocate those resources. If there is no possibility of resource leaks, cancelDiscard is preferable.

It is illegal to call await or awaitMany after this.

It is safe to call this multiple times, even after null is returned.

Threadsafe.

Params

  • s: *S

File

Io.zig:1632
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,
            };
        }