mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00

* rt: fix `Runtime::reactor()` as used by tokio-core Up until Tokio v0.1.11, the handle returned by `Runtime::reactor()` pointed to a reactor instance running in a background thread. The thread was eagerly spawned. As of v0.1.12, a reactor instance is created per runtime worker thread. `Runtime::reactor()` was deprecated and updated to point to the reactor for one of the worker threads. A problem occurs when attempting to use the reactor before spawning a task. Worker threads are spawned lazily, which means that the reactor referenced by `Runtime::reactor()` is not yet running. This patch changes `Runtime::reactor` back to a dedicated reactor running on a background thread. However, the background thread is now spawned lazily when the deprecated function is first called. Fixes #720 * Fix comment Co-Authored-By: carllerche <me@carllerche.com>