I know there is a Value type could allocate shared memory, but seems it could only contains basic c types.
Is there anyway allow us to pass complex data types like Queue/Map between processes ?
I know there is a Value type could allocate shared memory, but seems it could only contains basic c types.
Is there anyway allow us to pass complex data types like Queue/Map between processes ?
Use Managers. Create a Manager object, then invoke manager.Queue (for example) to create a sharable Queue proxy. You can then pickle the returned proxy object and pass that between processes.
Queue.Queue, which internally uses locks to achieve thread safety. Process safety is ensured by the Manager, which controls access. You should benchmark the Queue against other approaches and to see how its performance fares on your specific platform.