-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Introspect runtime flavor/configuration on Handle #5088
Comments
I'm fine w/ this. |
I don't mind adding such a method, but I am worried about the example you are showing us. The only situation where |
I am probably missing something @Darksonn - why would it not be OK to run some long running code in a current-thread runtime? Sure any other scheduled tasks will be blocked from running until the long running code is done, but that's just a perf degradation not a correctness issue right? In my use case the real perf-sensitive scenarios will always run with multi-threaded runtime, but some integration tests will run on current-thread runtimes and I just need them to be correct, not necessarily fast. |
This is more about what is good vs bad practice than what is a bug or not, but in general any code that "blocks" the runtime is bad, and honestly moreso if it's in the |
While what you're saying is true, the perf degradation is generally so bad that its unacceptable in pretty much every situation, but I admit that tests are probably a counterexample to that. |
Fair point. |
Some functions in tokio, such as block_in_place(), only work in a multi-threaded runtime. It would be great to be able to inspect the current configuration/flavor of the runtime so that we can conditionally call such functions, e.g.:
The text was updated successfully, but these errors were encountered: