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
block_on from local runtime, like tokio #116
Comments
Thanks! I don't know if it is proper for a thread-per-core runtime to have a built in thread pool. If we meant for let user sense every thread and every detail, maybe users can do it by their own? For example they may start a thread pool and do communication by their own? I haven't figured out what it should be, or if users can do this job purely by their own, or how to implement it yet. If you have any thought, please comment! :) |
I thought about it and I think maybe we have to implement it because users cannot touch the runtime internal components. |
Mistake correction: Since we have to recv the thread pool result, and we may wait for it with a sync channel, so in this thread we cannot spawn any other task or it will be blocked. If we start a single thread with monoio runtime and let it do this single one thing:
So if let users impl it, he/she has to:
If we impl it inside the runtime, we can save a seprated thread, and users don't have to do these complicated things including impl a thread pool. Something to think about: use a global thread pool or one thread pool for each runtime? Since creating threads are expensive, maybe we should share one thread pool between runtime threads. But it will be better if we can let user decide it. And it will cause api changing. An initial idea:
Here I think maybe we can take solution 1. If anyone have some different ideas, feel free to comment. |
I don't need the runtime inside each thread of the threadpool so that executing a function is enough, i.e., |
Spawn_blocking with non-blocking methods inside it doesn't make sense, since as its name indicates it must block and there are other methods to launch non-blocking methods in other threads. I think the best option is to separate this method from the Runtime and support it with another crate. I close this issue. |
I didn't get what you mean... |
I need to be able to fetch the current runtime of each thread and call blocking methods.
How does tokio with the functions
I think I could implement it.
Edit:
I see that it is quite difficult to get a local Executor because it depends on the Driver trait. I'm doing tests removing everything that is not ui-ring. It may fork you. With this I come to say that there is no rush with the issue and thank you for your work. I have already seen that you have it reflected in #8
The text was updated successfully, but these errors were encountered: