ringbuffer: bugfix some atomic access and test

there was a thinko in the read routine where it
decremented the index rather than increased.

fix:

    rbuf->ridx += len;

Added some atomic support but didn't nuke the cached len
until some more tests are written. The atomics used now
do work.

Added a short functionality test.

Comments:

Boy, do we have different coding styles. Sean must not write
on a 24 line laptop screen. Need sean-c-mode for emacs again.

ringbuffer tests need to move to a separate file/regression
suite.