First attempt at a lock-free ring buffer.
Reorganized the ring buffer to avoid duplicate code.
Queue: Fixed several bugs in the ring implementations