classification
Title: Allow for providing 'on_new_thread' callback to 'concurrent.futures.ThreadPoolExecutor'
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: bquinlan Nosy List: 2uasimojo, bquinlan, harlowja, vstinner
Priority: normal Keywords: patch

Created on 2015-09-01 19:13 by harlowja, last changed 2019-06-14 19:42 by bquinlan. This issue is now closed.

Files
File name Uploaded Description Edit
add_future_callback.patch harlowja, 2015-09-01 19:27 review
Messages (4)
msg249501 - (view) Author: Joshua Harlow (harlowja) * Date: 2015-09-01 19:13
In situations where thread-local variables need to be setup it is quite useful to be able to hook into the thread creation process, so that as each new thread is spun up by the ThreadPoolExecutor that the threads created initially call into a provided callback (the callback can then setup thread local state as needed).
msg249507 - (view) Author: Joshua Harlow (harlowja) * Date: 2015-09-01 19:27
Initial possible patch.
msg341772 - (view) Author: Brian Quinlan (bquinlan) * (Python committer) Date: 2019-05-07 16:24
Do the `initializer` and `initargs` parameters deal with this use case for you?

https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ThreadPoolExecutor
msg345635 - (view) Author: Brian Quinlan (bquinlan) * (Python committer) Date: 2019-06-14 19:42
Joshua, I'm closing this since I haven't heard from you in a month. Please re-open if you use case isn't handled by `initializer` and `initargs`.
History
Date User Action Args
2019-06-14 19:42:18bquinlansetstatus: open -> closed
messages: + msg345635

assignee: bquinlan
resolution: out of date
stage: resolved
2019-05-07 16:24:29bquinlansetmessages: + msg341772
2015-10-13 19:38:09vstinnersetnosy: + bquinlan
2015-10-13 19:35:43vstinnersetnosy: + vstinner
2015-09-01 19:27:302uasimojosetnosy: + 2uasimojo
2015-09-01 19:27:07harlowjasetfiles: + add_future_callback.patch
type: enhancement ->
messages: + msg249507

keywords: + patch
2015-09-01 19:16:04harlowjasetcomponents: + Library (Lib)
2015-09-01 19:15:50harlowjasettype: enhancement
2015-09-01 19:15:40harlowjasetversions: + Python 3.6
2015-09-01 19:13:12harlowjacreate