Loai Ghoraba Loai Ghoraba - 23 days ago 8
Python Question

Is python Queue.queue get and put thread safe?

http://docs.python.org/2/library/queue.html#Queue.Queue.put

It seems a naive question, but I didn't find the answer on the docs nor with Googling, so are these methods thread safe ? I assume so otherwise there is no point in this queue.

Answer

See 8.10 Queue — A synchronized queue class (at the top)

The Queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads.