Any reason why the runtime may spawn more threads than what I pass as limit in main macro? #4208
Answered
by
Darksonn
DevasiaThomas
asked this question in
Q&A
-
That is how my main function is. But I see more than that at times(upto 8). Would there be any reason for tokio to use more threads than limited? Thanks in advance :) PS: I am not doing any spawn_blocking. |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Nov 1, 2021
Replies: 1 comment 1 reply
-
Tokio does not spawn any extra threads if you are not using Note that the four threads are in addition to the main thread, so you can end up with five threads in your example, but not eight. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
hawkw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tokio does not spawn any extra threads if you are not using
spawn_blocking
. Perhaps you are using it indirectly viatokio::fs
or an external crate?Note that the four threads are in addition to the main thread, so you can end up with five threads in your example, but not eight.