How can I write asynchronous code?
How can I implement asynchroneous code in mojo (using
In the Changelog, I find the following example (slightly adjusted):
This gives me the following compiler error:
I do not understand this error, as I thought that
However, if I always put
In the changelog it furthermore says that tasks can be "resumed" after completion (see here). What is meant by "resume" and how do I do that?
I am working with the nightly built mojo 2024.7.2005 (96a1562c).
Addon: I asked this question on the Q&A page and on SO some time ago. Sorry for the double posting; I just do not know what is the best way to get in touch with people who can help. I will keep the copies up to date (or delete them if people think this would be better).
async etc.)?In the Changelog, I find the following example (slightly adjusted):
This gives me the following compiler error:
I do not understand this error, as I thought that
Coroutine is register passable (as visible in the source code). What works isHowever, if I always put
await on the right hand side, I will never be able to execute code asynchroneously, as I am always waiting until the line has finished. What am I doing wrong / where is my misconception? (Or is this simply a bug?)In the changelog it furthermore says that tasks can be "resumed" after completion (see here). What is meant by "resume" and how do I do that?
I am working with the nightly built mojo 2024.7.2005 (96a1562c).
Addon: I asked this question on the Q&A page and on SO some time ago. Sorry for the double posting; I just do not know what is the best way to get in touch with people who can help. I will keep the copies up to date (or delete them if people think this would be better).
GitHub
The Mojo Programming Language. Contribute to modularml/mojo development by creating an account on GitHub.

