2 ms·
so Thread based based pool will have same instance of generator, while Process based pool with have unique instance of generator?
by slt2021 3y ago
so Thread based based pool will have same instance of generator, while Process based pool with have unique instance of generator?
- TrianguloY 3y agoI don't know if a generator can be shared across threads, but in that case ... I have no idea :/ You'll need to search, or try!
- kzrdude 3y agoIn this example, calling sum() creates a generator and returns it. Say g = sum(). If you share g between threads, they will all use the same generator object! If you call sum() separately per thread, they will be different generators. If you try to send g to a different process, you will get an error, because it doesn't serialize.