-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking issue: an API for executors #2
Comments
Just leaving a list of previously discussed ideas:
|
The most promising direction at the moment would be: " Though that doesn't mean that we can't do any work while |
|
That is true, but their design greatly will inform what an executor API would look like. It doesn't seem fruitful to start designing a generalized async runtime APIs before we have clarity if and how That's why I'm recommending we start by doing a survey to gather requirements. So once we have more clarity on |
I feel like |
I encourage anyone thinking about designing an async abstraction to read this blog post about structured concurrency and the problems with spawn-like interfaces: https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/ And then check out the direction standard C++ is heading: Disclaimer: I am one of the authors of P2300, but not the blog post. |
I have written up a draft for the APIs of executors in #13 , feel free to have a look at it. I also agree that "with clauses" is the best way to plug in an executor, it would enable to user to add trait bound to specify the capabilities they need. |
A key goal is to be able to easily switch between executors. Currently, there is no standardised interface for executors, so how a program interacts with an executor is unique to each executor. On the bright side, most executors offer similar APIs (e.g., a spawn function). However, there are differences in the details and some constraints which are not reflected simply by function signatures (e.g., Tokio's requirement that all async code is within the context of an executor).
One approach would be to define a Spawn or Executor trait in std. In addition, there must be a way to 'plug in' the executor, since executors tend to be somewhat global, rather than passed around. We can follow follow the global allocator pattern, but this is not a complete solution since some programs require multiple executors.
Open issues
The text was updated successfully, but these errors were encountered: