This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Antony.Lee
Recipients Antony.Lee
Date 2015-10-01.22:09:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443737352.06.0.289026067314.issue25293@psf.upfronthosting.co.za>
In-reply-to
Content
http://bugs.python.org/issue21423 and http://bugs.python.org/issue24980 suggest adding an initializer/on_new_thread argument to {Thread,Process}PoolExecutor.  I would like to suggest a more unified API, that would allow not only handling initialization, but also finalization, by adding a {thread,process}_class attribute / constructor argument to {Thread,Process}PoolExecutor, so that one could do:

class MyThread(Thread):
    def run(self):
        initialize()
        try: super().run()
        finally: finalize()

with ThreadPoolExecutor(thread_class=MyThread): ...

Thoughts?
History
Date User Action Args
2015-10-01 22:09:12Antony.Leesetrecipients: + Antony.Lee
2015-10-01 22:09:12Antony.Leesetmessageid: <1443737352.06.0.289026067314.issue25293@psf.upfronthosting.co.za>
2015-10-01 22:09:12Antony.Leelinkissue25293 messages
2015-10-01 22:09:11Antony.Leecreate