About this question
Easy · concurrency · Quant Developer interview question · concurrency, low-latency, c++
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