]> git.tdb.fi Git - model-railway-devices.git/commit
Rewrite ringbuffer implementation to be interrupt-safe
authorMikko Rasa <tdb@tdb.fi>
Mon, 28 Oct 2013 18:28:07 +0000 (20:28 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 28 Oct 2013 18:28:07 +0000 (20:28 +0200)
commita4919e44177de59604d8c088487ede49e3884b35
treeb2ed70a21b221642f5fc14915e980c592f23750f
parent3211a14c47886703f9d287b142f6916182f62b88
Rewrite ringbuffer implementation to be interrupt-safe

The earlier version had a race condition with the fill variable, where an
interrupt might execute in the middle of increment/decrement and do the
opposite operation.  Each variable is now written to by only one end of
the buffer, eliminating the problem.
common/ringbuffer.h