返回题库

Quant Interview Practice Questions

专题
concurrency
难度
L1
来源
MyntBit

题目详情

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