Praveen Gollakota <pgollak...@gmail.com> writes:
> In the ThreadPoolExecutor (TPE), is the callback always guaranteed to run in 
> the same thread as the submitted function?

To answer question of this type (yourself), you may look
at the relevant source code.

I am quite sure that the "submitted function" will be executed
in one of the threads from the thread pool.

I have not looked at the "ThreadPoolExecutor" code. The easiest thing
would be to run the callback in the same thread as the submitted function.
However, it could facilitate use of the "ThreadPoolExecutor"
(less locking) when the synchronisation were done inside
the "ThreadPoolExecutor" and the callbacks were executed in a single
thread (likely the one which has set up the "ThreadPoolExecutor").
A look at the source should tell the details.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to