mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-18 00:00:09 +02:00
Previously, every call to `current_thread::Handle::spawn` would go through a `mpsc` channel. This is unnecessary when the `Handle` is still on the same thread as the current thread executor. This patch fixes that by storing the `ThreadId` of the executor when it is created, and then comparing against that when `Handle::spawn` is called. If the call is made from the same thread, `spawn_local` is used directly. Fixes #562.