WoooHaaaa
WoooHaaaa

Reputation: 20440

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 ?

Upvotes: 0

Views: 2654

Answers (1)

nneonneo
nneonneo

Reputation: 179402

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.

Upvotes: 1

Related Questions