Search code examples
pythonfuturepython-multiprocessingconcurrent.futures

What is the concurrent.futures-equivalent of multiprocessing.Lock?


For consistency, I'm trying to port some older code based on multiprocessing to concurrent.futures (using ProcessPoolExecutor). In my old code, I'm using the Lock class to synchronize writing to stdout. I can't seem to find a similar class in concurrent.futures. Is there one?


Solution

  • concurrent.futures is implemented on top of multiprocessing that is why it does not provide such an interface itself. You can test this by passing a lock to as a job argument.