how to use async in mojo?
I did what mojo bot told me to do, but I got the error below.
4 Replies
i think you need to do
await task()
The current version of Mojo does not support
main
being marked as async
. You can cause coroutines to be executed on the calling thread by calling them (e.g. let result: Int = task()
), but this kind of defeats the whole point of async
. There is not really much you can do with async
in Mojo right now until we build out more of the infrastructure around it.@Alex Kirchhoff May I ask about our usage plan for async based on coroutines, which version of mojo is expected to achieve the effect of immediate execution?
python