mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-09 04:16:37 +01:00
Rename `wait` to `await` to be consistent with Future API. The convention here is that this set of functionality goes together: * async/concurrent * await/cancel Also rename Select `wait` to `await` for the same reason. `Group.await` now can return `error.Canceled`. Furthermore, `Group.await` does not auto-propagate cancelation. Instead, users should follow the pattern of `defer group.cancel(io);` after initialization, and doing `try group.await(io);` at the end of the success path. Advanced logic can choose to do something other than this pattern in the event of cancelation. Additionally, fixes a bug in `std.Io.Threaded` future await, in which it swallowed an `error.Canceled`. Now if a task is canceled while awaiting a future, after propagating the cancel request, it also recancels, meaning that the awaiting task will properly detect its own cancelation at the next cancelation point. Furthermore, fixes a bug in the compiler where `error.Canceled` was being swallowed in `dispatchPrelinkWork`. Finally, fixes std.crypto code that inappropriately used `catch unreachable` in response to cancelation without even so much as a comment explaining why it was believed to be unreachable. Now, those functions have `error.Canceled` in the error set and propagate cancelation properly. With this way of doing things, `Group.await` has a nice property: even if all tasks in the group are CPU bound and without cancelation points, the `Group.await` can still be canceled. In such case, the task that was waiting for `await` wakes up with a chance to do some more resource cleanup tasks, such as canceling more things, before entering the deferred `Group.cancel` call at which point it has to suspend until the canceled but uninterruptible CPU bound tasks complete. closes #30601 |
||
|---|---|---|
| .. | ||
| crc | ||
| spirv | ||
| docgen.zig | ||
| doctest.zig | ||
| dump-cov.zig | ||
| fetch_them_macos_headers.zig | ||
| gen_macos_headers_c.zig | ||
| gen_outline_atomics.zig | ||
| gen_spirv_spec.zig | ||
| gen_stubs.zig | ||
| generate_c_size_and_align_checks.zig | ||
| generate_JSONTestSuite.zig | ||
| generate_linux_syscalls.zig | ||
| incr-check.zig | ||
| lldb_pretty_printers.py | ||
| macos-headers.c | ||
| migrate_langref.zig | ||
| process_headers.zig | ||
| stage1_gdb_pretty_printers.py | ||
| stage2_gdb_pretty_printers.py | ||
| std_gdb_pretty_printers.py | ||
| update-linux-headers.zig | ||
| update_clang_options.zig | ||
| update_cpu_features.zig | ||
| update_crc_catalog.zig | ||
| update_freebsd_libc.zig | ||
| update_glibc.zig | ||
| update_mingw.zig | ||
| update_netbsd_libc.zig | ||
| zig_gdb_pretty_printers.py | ||