Skip to content

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
Discussion options

You must be logged in to vote

Tokio does not spawn any extra threads if you are not using spawn_blocking. Perhaps you are using it indirectly via tokio::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.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DevasiaThomas
Comment options

Answer selected by hawkw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants