mp_ringbuffer: use memory barriers instead of locks

This ringbuffer implementation is thread unless the operations are reordered
by the CPU/compiler. Make it so that all memory operations are commited before
updating the position indexes within the ringbuffer.