About this question

Cooperative Queue Cancellation

Easy · concurrency · Quant Developer interview question · concurrency, multithreading, queue, c++

In quantitative trading systems, worker threads frequently poll concurrent queues to process high-throughput market data or order updates. Implementing cooperative cancellation ensures that these threads can unblock and exit cleanly during system shutdown without data corruption or busy-waiting. Task Implement a CancellableQueue class that provides thread-safe access and supports cooperative cancellation. Your class must implement the following methods: - void push(double val): Adds val to the