Skip to content

Do tokio reuse spawn_blocking threads? #3251

Answered by hawkw
sylvain101010 asked this question in Q&A
Discussion options

You must be logged in to vote

Tokio uses a dedicated thread pool of blocking worker threads for running blocking tasks. When a blocking worker completes its current blocking task, it returns to the blocking pool and will execute new blocking work when new blocking tasks are spawned.

When all blocking workers in the pool are busy, new blocking threads will be spawned, up to a limit configured by the max_threads runtime builder setting. Skimming the docs, it seems like this might not be stated clearly enough in the API documentation, we could definitely add something to clarify this.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by sylvain101010
Comment options

You must be logged in to vote
3 replies
@Darksonn
Comment options

@Darksonn
Comment options

@sylvain101010
Comment options

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