• 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: MP Threads & Core Audio
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MP Threads & Core Audio


  • Subject: Re: MP Threads & Core Audio
  • From: Herbie Robinson <email@hidden>
  • Date: Thu, 09 Aug 2007 17:10:29 -0400

At 3:36 PM -0400 8/8/07, Bob Stuller wrote:
Folks, Greetings!

Nearly five years ago, Kelly Jacklin wrote the following & now I need to know how valid his remarks are in 2007:
(I am not speaking for the CoreAudio group, but I have an intimate understanding of the MP API implementation, have done a lot of synchronization work on OSX, and have worked extensively with CoreAudio APIs...)


You really do not want to use the MP API for this. MPNotifyQueue takes a global (to the process) lock, in order to ensure the rather bizarre termination semantics of the MP API. If this lock is held by any other thread, your thread will priority invert with this thread, and you will end up blocking until that thread has relinquished this lock. While this is not usually a long time, it can be longer, depending on the actions being performed by other threads in your app and the load on the system.

In fact, when you are operating on the IOProc (which SoundInput completions are), you want to do as few blocking operations as possible (ideally none).

I suggest you use the pthreads APIs directly
... snip .... (For the rest of this excellent, detailed entry: http://lists.apple.com/archives/Coreaudio-api/2002/Oct/msg00542.html)


You see, I've inherited a body of code, mostly working, that uses the MP API & wouldn't feel right doing a total rewrite without asking. Thanks very much in advance.

Peace,
Bob

It depends on what you are trying to do. The above conversation is about real-time threads (the I/O callbacks for Core Audio are on real-time threads). If you aren't working with those callbacks and don't need real-time, they you don't need to change anything.


If you do need real-time performance, then you don't want to use the MP API. You also don't want to use a lot of things in pthreads -- like mutexes -- because you get priority inversion from those, too. Generally, the best way to communicate with the real-time threads is to use FIFOs.
--
-*****************************************
** http://www.curbside-recording.com/ **
******************************************
_______________________________________________
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: MP Threads & Core Audio
      • From: kelly jacklin <email@hidden>
References: 
 >MP Threads & Core Audio (From: Bob Stuller <email@hidden>)

  • Prev by Date: Re: Greyed out/duplicated MIDI devices in Audio/MIDI setup?
  • Next by Date: Re: MP Threads & Core Audio
  • Previous by thread: Re: MP Threads & Core Audio
  • Next by thread: Re: MP Threads & Core Audio
  • Index(es):
    • Date
    • Thread