-
Notifications
You must be signed in to change notification settings - Fork 493
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
Handle/guard support for current thread pool #1097
Comments
The implicit support is just our thread-local I guess for a guard, we would need a separate TLS which is checked before anything else. I fear that will add overhead to the critical path of what would normally be a local-only operation though. |
I'm doing some really not present things in the code righ now just to make rayon-based parallel code running on a specific thread pool.
Specifically I have two different thread pools and a piece of code that depending on some conditions needs to run on one of those thread pools.
The only way do do it right now is to use
thread_pool.install()
, but something like this would have been much more convenient:Moreover,
Handle::current()
should also be possible to capture current thread pool's handle, regardless of whether custom or global thread pool is used.This is similar in behavior to
tokio
andtracing
that both have local guards that allow you to enter/exit runtime/context/scope/span/etc.My educated guess is that something like this is already implicitly present, just not exposed to the user.
The text was updated successfully, but these errors were encountered: