• 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: Tricks to avoid mutexes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tricks to avoid mutexes


  • Subject: Re: Tricks to avoid mutexes
  • From: Jim Wintermyre <email@hidden>
  • Date: Wed, 19 Jan 2005 03:49:27 -0800

The MT-SMP list might be a more appropriate place for this question, but I'll throw out a few comments:

I'm working on an AudioUnit.

I'd basically like to know if storing an int/float/double is atomic.

Int store should be atomic, not sure about float/double. There are also the OSAtomic functions you could use which would be lighter weight than mutexes.


More exactly, if the storing instruction does comit all bytes into memory at
once.

For a mono cpu this is most likely true, since a context change cannot
happen in the middle of an instruction (afaik). I don't mind if a thread
gets an old copy of the data: I just don't want it to get a corrupted copy.

What happens for a dual cpu?  When one is storing to memory and the other is
reading from it, is it possible that it might get an half new/half old copy?

I guess the question is: does both cpu can access the memory at the same
time ? Even if one is writing to it? When one cpu write, the cache line for
the other has to be updated..

Mac HW is cache-coherent, so you should not need to worry about this.

I know it isn't good programming style to rely on such specific behavior,
but I'd like to avoid waiting a complete audio render cycle before applying
new paramaters.

On the other hand, you may not necessarily want to apply param updates at any arbitrary sample time. You might consider a separate lower param update rate.


Jim
_______________________________________________
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


  • Prev by Date: Fwd: background image in cocoa view AU
  • Next by Date: Re: Tricks to avoid mutexes
  • Previous by thread: Re: Tricks to avoid mutexes
  • Next by thread: USb audio driver (camcorder)
  • Index(es):
    • Date
    • Thread