[wdmaudiodev] Re: AVStream driver: Filter dispatch methods & automation methods synchronization

  • From: "alexander ivash" <elderorb@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 20 Jun 2016 22:30:59 +0300

Tim Roberts <timr@xxxxxxxxx> писал(а) в своём письме Mon, 20 Jun 2016 20:52:31 +0300:

If you design a circular buffer properly, with one reader and one
writer, no locks are ever needed.  Each side only moves one of the
pointers ("in" or "out").  The only time they need the other pointer is
to compute the amount of available data or empty space.  In that case,
it doesn't really matter that the pointer moved immediately after I read
it.  It just means there's more data to catch next time.  That's one of
the beauties of a circular buffer.

If it is written properly - then sure. :) But all the pointer operations needs to be atomic, correct? Which I can't guarantee in my case (although I can check what code is being produced by compiler of course).

Anyway, now its clear that there is no magic and auto-synchronization, so I need to review ringbuffer implementation to make sure it is 'thread-safe'

Thank you for your answers!

Regards, Alexander
******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: