Question

If I call task.wait() inside a thread that is managed by the thread pool, is that thread handed back to the thread pool so that it can be reused elsewhere while waiting or is it kept idle (therefore not reused) until the task completes ?

I would suspect the second one as it would be the behaviour for any thread that is not managed by the thread pool.

Was it helpful?

Solution

Simple answer: No. The thread has no concept of a thread pool, so Wait can not do special things. Also reusing a thread like this may have serious side effects (on thread local variables which may have changed).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top