Now we have 3 different API compatible MPMC queues that we can swap with swapping the header. mt_mpmc.h, a blocking queue that uses a mutex/critical section. lf_mpmc.h, a lock free queue that uses atomics. sm_mpmc.h, a hybrid queue that uses atomics and a semaphore to block when the queue is empty. In this program, for max performance it is recommanded to use sm_mpmc.h or mt_mpmc.h, they are designed to avoid busy waiting which frees more CPU time to do useful work.
9.6 KiB
9.6 KiB