Skip to content

Would rayon::ThreadPool::spawn surely spawn on another thread? #1230

Answered by cuviper
nrbnlulu asked this question in Q&A
Discussion options

You must be logged in to vote

No, if you call that when you're already on a thread in the pool, it will add to that local queue. Thus that may run locally if you ever block on rayon and it looks for more work, or it may run elsewhere if another thread steals it. But even if we put that on the pool's global queue, there's a chance it could be picked up by the current thread as well.

Replies: 2 comments

Comment options

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

You must be logged in to vote
0 replies
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