简体   繁体   中英

How can I share a Queue between processes in Python?

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 Manager s . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM