Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

who runs done_callback function? #149

Open
qiankunli opened this issue Dec 23, 2024 · 1 comment
Open

who runs done_callback function? #149

qiankunli opened this issue Dec 23, 2024 · 1 comment

Comments

@qiankunli
Copy link

for example

caller thread:
           with ProcessPool(max_workers=xx) as pool:
              future = pool.schedule(task_function, xx, timeout=xx)
              future.add_done_callback(done_callback_function)
           ...

who runs done_callback_function?caller thread or process which runs the task_function?

@noxdafox
Copy link
Owner

noxdafox commented Jan 26, 2025

Hello,

the callback is executed by a thread within the Pool itself once results have been delivered back to the main process. Hence, its execution happens on the process which has been scheduling the task_function.

The same implementation as concurrent.futures.ProcessPoolExecutor and multiprocessing.Pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants