【发布时间】:2012-12-12 18:00:28
【问题描述】:
http://docs.python.org/2/library/queue.html#Queue.Queue.put
这似乎是一个幼稚的问题,但我在文档和谷歌搜索中都没有找到答案,那么这些方法是线程安全的吗?我假设是这样,否则这个队列没有意义。
【问题讨论】:
-
The Queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threadsdocs 中的第一段。它还在标题中使用synchronized queue,这意味着它是线程安全的。 -
这确实是这样,非常感谢:)
-
是的,
Queue是线程安全的。
标签: python