|
|
Log in / Subscribe / Register

One and a half colors

One and a half colors

Posted Dec 4, 2025 21:40 UTC (Thu) by ofranja (subscriber, #11084)
In reply to: One and a half colors by khim
Parent article: Zig's new plan for asynchronous programs

> And how many of these have both of these executors running, simultaneously?

You can have multiple runtimes side-by-side in Rust, unless there is a specific limitation on the implementation of your runtime that prevents it. Nevertheless, it would be an implementation issue and not a language issue.

If you want an example, send this request to the LLM of your preference:

"Please write a simple example of a Rust program using async-std and tokio simultaneously in the same program."

> But if you try to do that you would quickly find out that mixing different futures (and thus different wakers) can easily lead to trouble.

You might not be able to use certain functions from a runtime's library in another runtime if they are implemented by the runtime itself - ie: what you call is a function that signals an action to the runtime and the function itself does not "execute" anything, and just waits for the action to complete.

In any case, this is easily solvable by communicating between different runtime contexts using channels and matching the library function calls to the particular runtime.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds