Implement a generic thread-safe queue.
Differently from the partitioned queue, this is intended as a swap-in replacement for queue.Queue.
That is, AtomicPartitionedQueue optimizes for throughput by increasing the overhead for an individual thread to start producing into or consuming from the queue.
AtomicQueue should instead optimize for latency, which is important for workloads that just care about serialization.
Therefore, the overhead for an individual thread to produce to or consume from the queue for the first time should be zero.
Implement a generic thread-safe queue.
Differently from the partitioned queue, this is intended as a swap-in replacement for
queue.Queue.AtomicPartitionedQueue#31That is,
AtomicPartitionedQueueoptimizes for throughput by increasing the overhead for an individual thread to start producing into or consuming from the queue.AtomicQueueshould instead optimize for latency, which is important for workloads that just care about serialization.Therefore, the overhead for an individual thread to produce to or consume from the queue for the first time should be zero.