Doug Hellmann has what looks like a similar example using a poison pill (2nd
example at)
https://pymotw.com/2/multiprocessing/communication.html#multiprocessing-queues
Note that join() allows the processes to finish so it you don't care then don't
"join()" them. You can also terminate a multi
Atul Johri writes:
> I am looking for a way to stop a ThreadPoolExecutor immediately under the
> assumption that I don't care about what's currently running or pending.
>
> ```
> limit = 2
> executor = ThreadPoolExecutor(10)
> posts = itertools.islice(mygen(executor=executor, **kwargs), 0, limit)
I am looking for a way to stop a ThreadPoolExecutor immediately under the
assumption that I don't care about what's currently running or pending.
```
limit = 2
executor = ThreadPoolExecutor(10)
posts = itertools.islice(mygen(executor=executor, **kwargs), 0, limit)
for post in posts:
print(post)