async-executor
async-executor copied to clipboard
StaticLocalExecutor usage example?
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!