fatal bug fixed

logic for prevent from overwriting in RingBuf was completely wrong.
(it always waited read func till Nw=Nr)