There is this question Why do we need gevent.queue? which asks about the necessity of gevent.queue.Queue
regarding the fact that there is no parallelism, but only concurrency with gevent
. Rightfully, the answer explains:
[...] you might want to ensure that a series of statements execute atomically [...]
So each method should be atomic, which explains why we need a queue object instead of a "regular" list, for example. However, according to Python docs https://docs.python.org/3/library/queue.html a queue.Queue
object already has those safety features:
It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The Queue class in this module implements all the required locking semantics.
So why is there gevent.queue.Queue
when queue.Queue
already exists? Are more safety features required or is it a question of performance?