[issue36395] Add deferred single-threaded/fake executor to concurrent.futures
Brian McCutchon
report at bugs.python.org
Mon May 6 19:05:13 EDT 2019
Brian McCutchon <bmccutchon at google.com> added the comment:
I understand your hesitation to add a fake. Would it be better to make it possible to subclass Executor so that a third party implementation of this can be developed?
As for an example, here is an example of nondeterminism when using a ThreadPoolExecutor with a single worker. It sometimes prints "False" and sometimes "True" on my machine.
from concurrent import futures
import time
complete = False
def complete_eventually():
global complete
for _ in range(150000):
pass
complete = True
with futures.ThreadPoolExecutor(max_workers=1) as pool:
pool.submit(complete_eventually)
print(complete)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36395>
_______________________________________
More information about the Python-bugs-list
mailing list