How to achieve maximum throughput without using lock-free mechanism? On thread-safety circular queue
I use two mutexes for enqueueTS() and dequeueTS(), so that writer and reader threads can run simultaneously without waiting for each other. However, both enqueueTS() and dequeueTS() can affect member numOfElements in struct queue_t eventually, causing race condition.