Will multi-threaded operations in Rust use different runtime modes based on the current asynchronous runtime, such as tokio

Will multi-threaded operations in Rust use different runtime modes based on the current asynchronous runtime, such as tokio
How should I use it? Is this effective

thread::spawn(|| {
            handle_connection(stream);
        });

Nope. If you want to spawn something in a tokio-aware way, you can use tokio::task::spawn_blocking (but read the docs first to know if your situation fits).

If I want to be compatible with multiple asynchronous runtimes, do I have to use

You would either need to make different versions of the code for each runtime, or have the user supply a spawning function.