返回题库

Quant Interview Practice Questions

专题
concurrency
难度
L1
来源
MyntBit

题目详情

In ultra-low-latency trading systems, thread synchronization is often implemented using spin-locks or spin-wait loops rather than OS-level mutexes to eliminate context-switch overhead. The std::atomic_flag is the simplest atomic type in C++ and is guaranteed to be lock-free, making it an excellent building block for low-latency synchronization primitives. Task Implement a reusable spin-wait barrier for exactly two threads by completing the SpinBarrier class and its wait() method. The wait() met