• 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: Threading Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threading Question


  • Subject: Re: Threading Question
  • From: Michael Tyson <email@hidden>
  • Date: Mon, 13 Feb 2012 10:39:04 +0100

Good lord, you're right, Michael - I'm so glad I posted it and you took a look =)

It actually used to have the barriers in there, but I (stupidly) removed them at some point.

I've just popped them back in, replacing the atomic adds with the barrier variety, within Produce and Consume. Do you think that'll do it?

https://github.com/michaeltyson/TPCircularBuffer

Thanks again for taking a look and taking the time to point out the stupid!


On 13 Feb 2012, at 02:08, email@hidden wrote:

> The code linked to does not have any memory barriers at all. There is
> nothing stopping writes from the memcpy (in
> TPCircularBufferProduceBytes) being reordered (by the CPU) such that
> they become visible after the OSAtomicAdd32 (in
> TPCircularBufferProduce). There needs to be a write barrier after the
> memcpy in order to be safe.
>
> Similarly, the memory barrier on read is missing too - this is needed
> between copying fillCount in to availableBytes (in TPCircularBufferTail)
> and returning from TPCircularBufferTail.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Threading Question
      • From: Kyle Sluder <email@hidden>
References: 
 >Re: Threading Question (From: Morgan Packard <email@hidden>)
 >Re: Threading Question (From: Kyle Sluder <email@hidden>)
 >Re: Threading Question (From: Michael Tyson <email@hidden>)
 >RE: Threading Question (From: email@hidden)

  • Prev by Date: RE: Threading Question
  • Next by Date: Re: Threading Question
  • Previous by thread: Re: Threading Question
  • Next by thread: Re: Threading Question
  • Index(es):
    • Date
    • Thread