• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Lock-free protocols? Making circular buffers.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lock-free protocols? Making circular buffers.


  • Subject: Re: Lock-free protocols? Making circular buffers.
  • From: Andre Lipinski <email@hidden>
  • Date: Mon, 22 Apr 2002 14:43:05 -0400

Hi,

Buffer passing without locks is best done with a circular buffer IMHO.

A circular buffer is most easily described as a structure of mostly a contiguous lump of memory big enough to hold x samples plus a read-to pointer and a write-at pointer, and a way to remember what x is. One process always writes to the buffer, it always increments write-at after each write (and circles to the beginning when it hits the end and always stops before read-to) another process always reads and reads up to write-at, incrementing it's pointer and circling to the beginning too. The trick is to use atomic operations for the incrementing, like IncrementAtomic() from CoreServices/DriverSynchronization.h.

That ought to do ya.
Andre.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Lock-free protocols?
  • Next by Date: Sample Rate Support and Core Audio
  • Previous by thread: Re: Lock-free protocols?
  • Next by thread: Documentation suggestion
  • Index(es):
    • Date
    • Thread