Implement an SPMC (single-producer, multi-consumer) queue. It does not need to be lock-free and it does not need to be performant, but the functionality must be complete.
Asked in the take-home test stage. It was the first of two take-home tasks. The original wording asked for a complete, working single-producer multi-consumer (SPMC) queue; it does not need to be lock-free or high-performance.
Implement SPMCQueue with put(item), get(), close(), and empty() methods. get() blocks while the queue is open and empty, then returns None after closure and exhaustion. put() raises RuntimeError after closure. Items are returned in FIFO order, and None cannot be enqueued.
put.get concurrently.put does not block because of capacity.def run_operations(operations):