It’s also worth noting that there are two different ways to spawn new tasks:
-
@async
which will always run the task on the same hardware thread as the current task, and will only make progress when the current task blocks and yields back to the scheduler; -
@spawn
which creates a task that can be run on any hardware thread, so it can make progress while the current task is still working if there are other threads available.
You can synchronize both with @sync
.