fb5588413f
Updates the requirements on [async-io](https://github.com/smol-rs/async-io) to permit the latest version. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/smol-rs/async-io/releases">async-io's releases</a>.</em></p> <blockquote> <h2>v2.0.0</h2> <ul> <li><strong>Breaking:</strong> <code>Async::new()</code> now takes types that implement <code>AsFd</code>/<code>AsSocket</code> instead of <code>AsRawFd</code>/<code>AsRawSocket</code>, in order to implement I/O safety. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li><strong>Breaking:</strong> <code>Async::get_mut()</code>, <code>Async::read_with_mut()</code> and <code>Async::write_with_mut()</code> are now <code>unsafe</code>. The underlying source is technically "borrowed" by the polling instance, so moving it out would be unsound. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li>Expose miscellaneous <code>kqueue</code> filters in the <code>os::kqueue</code> module. (<a href="https://redirect.github.com/smol-rs/async-io/issues/112">#112</a>)</li> <li>Expose a way to get the underlying <code>Poller</code>'s file descriptor on Unix. (<a href="https://redirect.github.com/smol-rs/async-io/issues/125">#125</a>)</li> <li>Add a new <code>Async::new_nonblocking</code> method to allow users to avoid duplicating an already nonblocking socket. (<a href="https://redirect.github.com/smol-rs/async-io/issues/159">#159</a>)</li> <li>Remove the unused <code>fastrand</code> and <code>memchr</code> dependencies. (<a href="https://redirect.github.com/smol-rs/async-io/issues/131">#131</a>)</li> <li>Use <code>tracing</code> instead of <code>log</code>. (<a href="https://redirect.github.com/smol-rs/async-io/issues/140">#140</a>)</li> <li>Support ESP-IDF. (<a href="https://redirect.github.com/smol-rs/async-io/issues/144">#144</a>)</li> <li>Optimize the <code>block_on</code> function to reduce allocation, leading to a slight performance improvement. (<a href="https://redirect.github.com/smol-rs/async-io/issues/149">#149</a>)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/smol-rs/async-io/blob/master/CHANGELOG.md">async-io's changelog</a>.</em></p> <blockquote> <h1>Version 2.0.0</h1> <ul> <li><strong>Breaking:</strong> <code>Async::new()</code> now takes types that implement <code>AsFd</code>/<code>AsSocket</code> instead of <code>AsRawFd</code>/<code>AsRawSocket</code>, in order to implement I/O safety. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li><strong>Breaking:</strong> <code>Async::get_mut()</code>, <code>Async::read_with_mut()</code> and <code>Async::write_with_mut()</code> are now <code>unsafe</code>. The underlying source is technically "borrowed" by the polling instance, so moving it out would be unsound. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li>Expose miscellaneous <code>kqueue</code> filters in the <code>os::kqueue</code> module. (<a href="https://redirect.github.com/smol-rs/async-io/issues/112">#112</a>)</li> <li>Expose a way to get the underlying <code>Poller</code>'s file descriptor on Unix. (<a href="https://redirect.github.com/smol-rs/async-io/issues/125">#125</a>)</li> <li>Add a new <code>Async::new_nonblocking</code> method to allow users to avoid duplicating an already nonblocking socket. (<a href="https://redirect.github.com/smol-rs/async-io/issues/159">#159</a>)</li> <li>Remove the unused <code>fastrand</code> and <code>memchr</code> dependencies. (<a href="https://redirect.github.com/smol-rs/async-io/issues/131">#131</a>)</li> <li>Use <code>tracing</code> instead of <code>log</code>. (<a href="https://redirect.github.com/smol-rs/async-io/issues/140">#140</a>)</li> <li>Support ESP-IDF. (<a href="https://redirect.github.com/smol-rs/async-io/issues/144">#144</a>)</li> <li>Optimize the <code>block_on</code> function to reduce allocation, leading to a slight performance improvement. (<a href="https://redirect.github.com/smol-rs/async-io/issues/149">#149</a>)</li> </ul> <h1>Version 1.13.0</h1> <ul> <li>Use <a href="https://crates.io/crates/rustix/"><code>rustix</code></a> instead of <a href="https://crates.io/crates/libc/"><code>libc</code></a>/<a href="https://crates.io/crates/windows-sys/"><code>windows-sys</code></a> for system calls (<a href="https://redirect.github.com/smol-rs/async-io/issues/76">#76</a>)</li> <li>Add a <code>will_fire</code> method to <code>Timer</code> to test if it will ever fire (<a href="https://redirect.github.com/smol-rs/async-io/issues/106">#106</a>)</li> <li>Reduce syscalls in <code>Async::new</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/107">#107</a>)</li> <li>Improve the drop ergonomics of <code>Readable</code> and <code>Writable</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/109">#109</a>)</li> <li>Change the "<code>wepoll</code>" in documentation to "<code>IOCP</code>" (<a href="https://redirect.github.com/smol-rs/async-io/issues/116">#116</a>)</li> </ul> <h1>Version 1.12.0</h1> <ul> <li>Switch from <code>winapi</code> to <code>windows-sys</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/102">#102</a>)</li> </ul> <h1>Version 1.11.0</h1> <ul> <li>Update <code>concurrent-queue</code> to v2. (<a href="https://redirect.github.com/smol-rs/async-io/issues/99">#99</a>)</li> </ul> <h1>Version 1.10.0</h1> <ul> <li>Remove the dependency on the <code>once_cell</code> crate to restore the MSRV. (<a href="https://redirect.github.com/smol-rs/async-io/issues/95">#95</a>)</li> </ul> <h1>Version 1.9.0</h1> <ul> <li>Fix panic on very large durations. (<a href="https://redirect.github.com/smol-rs/async-io/issues/87">#87</a>)</li> <li>Add <code>Timer::never</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/87">#87</a>)</li> </ul> <h1>Version 1.8.0</h1> <ul> <li>Implement I/O safety traits on Rust 1.63+ (<a href="https://redirect.github.com/smol-rs/async-io/issues/84">#84</a>)</li> </ul> <h1>Version 1.7.0</h1> <ul> <li>Process timers set for exactly <code>now</code>. (<a href="https://redirect.github.com/smol-rs/async-io/issues/73">#73</a>)</li> </ul> <h1>Version 1.6.0</h1> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
---|---|---|
.. | ||
examples | ||
src | ||
Cargo.toml | ||
README.md |
Bevy Tasks
A refreshingly simple task executor for bevy. :)
This is a simple threadpool with minimal dependencies. The main usecase is a scoped fork-join, i.e. spawning tasks from
a single thread and having that thread await the completion of those tasks. This is intended specifically for
bevy
as a lighter alternative to rayon
for this specific usecase. There are also utilities for
generating the tasks from a slice of data. This library is intended for games and makes no attempt to ensure fairness
or ordering of spawned tasks.
It is based on async-executor
, a lightweight executor that allows the end user to manage their own threads.
async-executor
is based on async-task, a core piece of async-std.
Usage
In order to be able to optimize task execution in multi-threaded environments, bevy provides three different thread pools via which tasks of different kinds can be spawned. (The same API is used in single-threaded environments, even if execution is limited to a single thread. This currently applies to WASM targets.) The determining factor for what kind of work should go in each pool is latency requirements:
-
For CPU-intensive work (tasks that generally spin until completion) we have a standard [
ComputeTaskPool
] and an [AsyncComputeTaskPool
]. Work that does not need to be completed to present the next frame should go to the [AsyncComputeTaskPool
]. -
For IO-intensive work (tasks that spend very little time in a "woken" state) we have an [
IoTaskPool
] whose tasks are expected to complete very quickly. Generally speaking, they should just await receiving data from somewhere (i.e. disk) and signal other systems when the data is ready for consumption. (likely via channels)