• 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: AudioUnit problem: CFRunLoopRunInMode() spins after first thread exits, and second thread begins?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioUnit problem: CFRunLoopRunInMode() spins after first thread exits, and second thread begins?


  • Subject: Re: AudioUnit problem: CFRunLoopRunInMode() spins after first thread exits, and second thread begins?
  • From: Jeff Moore <email@hidden>
  • Date: Wed, 15 Oct 2008 14:55:08 -0700

According to the documentation for CFRunLoopRunInMode(), kCFRunLoopRunFinished is returned whenever the run loop doesn't have any sources or timers installed on it. That makes me think that there is a problem with how you are setting things up.

On Oct 15, 2008, at 1:00 PM, Jeremy Friesner wrote:

Hi all,

I have a curious problem with my audio playback code. What my program does is spawn a thread that uses AudioUnit to play back a generated stream of audio. In general, this works fine. The problem occurs when (for reasons I won't go into here) my program needs to shut down the thread, and then later spawn another one that is identical to it. The second time, the thread doesn't work correctly... in particular, CFRunLoopRunInMode() immediately returns 1 (aka kCFRunLoopRunFinished) instead of waiting the expected one second and then returning kCFRunLoopTimedOut. This causes one of my Mac's CPU cores to become pegged at 100%, which I want to avoid.

Can anyone hazard a guess as to why this is happening? I do a "gentle" shutdown of the first thread (my main thread sets the _keepGoing flag to false, and then waits for the audio thread to clean up after itself and exit), so I'd expect it to work okay...



--

Jeff Moore
Core Audio
Apple


_______________________________________________ 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
References: 
 >AudioUnit problem: CFRunLoopRunInMode() spins after first thread exits, and second thread begins? (From: Jeremy Friesner <email@hidden>)

  • Prev by Date: AudioUnit problem: CFRunLoopRunInMode() spins after first thread exits, and second thread begins?
  • Next by Date: handling inequal in and out sample counts
  • Previous by thread: AudioUnit problem: CFRunLoopRunInMode() spins after first thread exits, and second thread begins?
  • Next by thread: handling inequal in and out sample counts
  • Index(es):
    • Date
    • Thread