Pregunta

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.

¿Fue útil?

Solución

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).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top