New submission from Antony Lee:

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?

----------
components: Library (Lib)
messages: 252067
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Hooking Thread/Process instantiation in concurrent.futures.
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25293>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to