Skip to content
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

StaticLocalExecutor usage example? #119

Open
jbr opened this issue May 28, 2024 · 0 comments
Open

StaticLocalExecutor usage example? #119

jbr opened this issue May 28, 2024 · 0 comments

Comments

@jbr
Copy link
Contributor

jbr commented May 28, 2024

I was excited to see the addition of StaticExecutor and StaticLocalExecutor optimizations, and started async-global-executor#17 with the intent to adopt both of them. However, it is unclear from the examples how exactly to use StaticLocalExecutor.

The documentation suggests using it with thread_local!, but LocalKey intentionally only offers scoped lifetime access in with in order to prevent usage from other threads. StaticLocalExecutor::spawn requires &'static self, which cannot be directly obtained from tls. Does that lifetime have to be 'static? If so, how is this intended to be used?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant